User forums > Using Code::Blocks
Problem with CommandLineToArgvW
(1/1)
IHNIWTFID:
Hi, I'm trying to get the arguments from commandline inside WinMain.
Im using this code:
--- Code: ---LPWSTR *Arglist;
int nArgs;
Arglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);
for(int i=0; i<nArgs; i++) cout<<(LPSTR)Arglist[i]<<endl;
LocalFree(Arglist);
--- End code ---
The code above work fine in VS2010. But in Code::Blocks it returns only the first character of each argument.
Would someone please tell me what I'm doing wrong?
jarod42:
Unrelated to Code::Blocks.
but I assume you use g++ in Code::Blocks
LPWSTR != LPSTR and your conversion is not portable.
Jenna:
--- Quote from: jarod42 on September 17, 2012, 12:44:22 pm ---Unrelated to Code::Blocks.
--- End quote ---
and therefore violating our forum rules !
Please respect the rules as you have accepted with registering here !
Topic locked !
Navigation
[0] Message Index
Go to full version