These things are getting on my nerves. I am trying to do a test program in Win32 API which has "Browse for folder" and uses some string formatting. But, I am unable to.
Please help in this general problem:
If I use strcpy() in Visual Studio 2008 to do some string related things, the problem is only the first character of the dest_str is replaced from the source_str. For Ex:
char S1 = "C:\\Program Files" ;\\Also tried wchar_t char S2= "Zebra"; strpy(S1,S2); \\will have to type-cast paramaters to(char *) if wchar_t is used
Now, if I display S1, it outputs : Z:\Program files
What the heck^ ?
I had to manually do a while() loop to simulate strcpy function. But, this while() cannot be used to do anything sprintf() or similar does. If I use sprintf(), I'll have to put the first parameter as char, the second parameter cannot be made into any WSTR as sprintf doesn't understand that. Now, if I display in a messagebox the string from sprintf, typecasted in LPWSTR, it displays boxes, instead of letters.
As, an alternative if I use _itoa() or strcat, it results in the same problems as I have mentioned above(with typecasting problems too).
Any "C" style string functions doesn't work in the program.
MAN! I'm stuck in a very big problem! Now, I googled and got some info on str.Format(). But, I cannot use it as compiler reports an error that left of .Format must be struct/namespace/blah blah. I cannot either use Cstring as the "Cstring" idientifier is not found!!! I think I have used all the header files I knew of and none worked!
Now, can anyone help me here? What do I use for string formatting in a Win32 Shell Program(as may be strcpy or strncpy is deprecated)? Or is the compiler gone mad? Is there any alternative other than the things mentioned above?
Thanks in advance!