|
Thank you Stuart,
Can you please help in converting from ASCII to Unicode and vice versa, so that I don't face this problem in either of the conversion.
Neelesh K J Jain.
|
|
|
|
|
|
If you're using VC++2003, 2005 or 2008, it's very easy. If you #include <atlconv.h>, you have various string conversion macros[^] available.
If you're using Visual C++ 6, you have similar macros[^] available.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I have a print method here. I'm trying to print lets say 3 numbers per line ( print(2);). If I had 7 elements, my output would be.
10 12 13
11 15
17 12
How do I get that first line to only print two? Is it going to be something with i % num?
public void print( int num )
{
if( num < 1 )
num = 1;
for(int i = 0; i < size; i++)
{
System.out.print(list[i] + " ");
if( i != 0 && i % num == 0)
System.out.println();
}
}
|
|
|
|
|
Hmmmm - that's not C++, is it - that's C#. Wrong forum, me bucko!
But anyway - the reason is because your test is wrong. Should be if(i % num == (num-1)) .
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I tried that, but it will print something like
10 12
14 13 15
and that still isn't right.
I figured it out, it's actually my System.out.println(list[i]) has to come after the if statement.
Java too btw. Thanks for the idea though.
|
|
|
|
|
This worked OK when I translated it to C++:
public void print( int num )
{
if( num < 1 )
num = 1;
for(int i = 0; i < size; i++)
{
System.out.print(list[i] + " ");
if( i % num == (num-1) || i==size-1)
System.out.println();
}
}
in roughly comparable idiomatic C++, this is:
void print(std::vector<int> const& list, int num )
{
if( num < 1 )
num = 1;
for(int i = 0; i < list.size(); i++)
{
std::cout << list[i] << " ";
if( i % num == (num-1) || i==list.size()-1)
std::cout << std::endl;
}
}
jonig19 wrote: Java too btw
Java, C# - I wasn't a million miles away Maybe I ought to add C# to my sig!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hello!
When opening the Property Pages of a project in Visual Studio 2005/2008, the configuration and platform are set by default to the Active ones. For example: Active(Release) and Active(Win32).
Is there any possibility to set the All Configurations and All Platforms options by default in those two combo-boxes? What I mean is that I would like not the set them manually to All Configurations and All Platforms everytime I open the Property Pages of a project, but have them instead set by default.
Thanks in advance!
|
|
|
|
|
I don't think there is.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I have created a MFC dialog based application.
I tried to use shared pointer, but it not geting compiled.
std::tr1::shared_ptr<CSharedpointerDlg> sharedpointer;
How to rectify this error
: error C2039: 'tr1' : is not a member of 'std'
: error C2065: 'shared_ptr' : undeclared identifier
VIBIN
"Fool's run away,where angle's fear to tread"
|
|
|
|
|
VC++6 doesn't include TR1 - how could it? It shipped before the original C++ standard came out, never mind TR1!!!!
To get TR1 features, use VC++2008 or Boost's[^] implementation[^].
Oh and by the way - VC++6 is no longer supported in much of Boost, so you may have problems there.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
tr1 is not a part of the STL that ships with VC6.
try boost.
(heh... too late)
|
|
|
|
|
Hey guys,
I got a linker problem.. I have written some .h files and .cpp files for being used in any project, and put them to a folder named "common".
Now I have a project and I set up the vc directories. I add include and source file folders to there. And I include the main .h header file. Compiling is ok but when it comes to linking linker says unresolved external symbol ... So it couldn't find the body in the cpp file.
So how can I tell the linker to use the cpp file?
Thank you...
|
|
|
|
|
You don't tell the linker to use the cpp file - the cpp file's source code, but the linker wants object code...
What you need to do is give the linker a command line that tells it all the object files that are produced by the compiler, plus any import libraries for system libraries (DLLs) that you reference.
BTW - just suggesting here, but we might be able to help even more if you gave an exact error message.
|
|
|
|
|
Error 1 error LNK2019: unresolved external symbol "public: __thiscall CXControl::~CXControl(void)" (??1CXControl@@QAE@XZ) referenced in function "public: __thiscall CXDesktop::~CXDesktop(void)" (??1CXDesktop@@QAE@XZ) DX.obj
This is one of the errors...
SO how can I tell Linker/Compiler to do that
|
|
|
|
|
I should have read your original message more closely - anyway - what Code-o-mat said, add the cpp files to your VC++ project. It'll compile them and link their object files into the final executable.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
You need to add your cpp files to your project otherwise it won't know where it should look for the actual implementations of the methods and rest declared in the header files.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Actually this is exacly I am trying to avoid... I do not want to add .cpp files.
But if I have to then I will..
So any other suggestions?
|
|
|
|
|
Well, you could build libraries of your implementations and link to these using #import or such. I never did this so i don't know how it works but i believe that is one way of doing it.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Create a separate static library project for the CPP files and get that to build a static library from the cpp files for you. Then, tell the project that uses that functionality to link against the static library.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Yeah that's what I did.. Thank you.
I create a static library put all my .h and .cpp files in it and compile create my .lib file. And put it into my application. Now it works..
Thank you again.
|
|
|
|
|
Ribbon application crash on some systems while it works fine on others. I have statically linked to MFC. Still it crashes on random systems. I debugged it on the system on which it crashed and found that the FindByID returns NULL for CMFCRibbonSlider in OnUpdate.. function. Other ribbon controls are working fine.
CMFCRibbonBar* pRibbon = ((CMainFrame*) GetTopLevelFrame())->GetRibbonBar();<br />
ASSERT_VALID(pRibbon);<br />
CMFCRibbonSlider* pSlider = DYNAMIC_DOWNCAST(CMFCRibbonSlider, pRibbon->GetCategory(0)->FindByID(ID_EDIT_EXPAND_COLLAPSE));
Why does it return NULL only on some systems ?
What might be the problem?
Thanks in Advanc
|
|
|
|
|
i want to open particular (C directoy in separate browser window .how i do this?
|
|
|
|
|
Hello Pooja,
You can use ShellExecute() . Please see the code snippet.
ShellExecute( NULL, _T("explore"), _T("c:\\"), 0, 0, SW_SHOW );
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Hi i am using a grid in feature .
My requirement is to make a first 3 columns read only. and last i.e 4 th column
write only.
Please tell me which property should i use..
I am not able to find it . Please help
|
|
|
|