Passing program arguements as wchar_t
I can't seems to pass the program arguments in the Project->Settings->Debug->Program arguements text box as type wchar_t. I have come to this conclusion because the wchar_t variable i am trying to define is not being
defined with the input that is in the program arguements box.
My code is as follows:
wchar_t fileName[256];
void CreateFileName( wchar_t *fn )
{
swprintf( fileName, L"%ls", fn);
//show names
wprintf(L"File Name = %ls\n", fileName );
}
int main(int argc, wchar_t* argv[])
{
CreateFileName(argv[0]);
}
if I do the following, it works fine.
int main(int argc, wchar_t* argv[])
{
wchar_t* name = L"firstfile";
CreateFileName(name);
return 0;
}
I have enable unicode by including #define UNICODE and _UNICODE, i'm using visual C++ 6.0 btw.
Thanks in advance for any help.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement