C++ argv just getting first character

Plugging away at a untility to help with my Jag dev stuff and hit upon a snag.  Using what looked like pretty standard argc, argv processing code all I could get would be the ‘-‘ preceeding the command, or the 1st character if there was no -.  It turns out that this is due to Visual Studio 2008/2010 defaulting to Unicode with projects, so if you are trying to work with them as standard chars you are not going to have much luck due to the endianness terminating the 1st character effectively.

Simplest fix.. Bring up the project properties, select Configuration > General and on the right hand side under “Project Defaults” change “Character Set” to “Not Set”, bye bye unicode.

That has been doing my head in all night, hope its of help to someone else.

Leave a Reply

Your email address will not be published. Required fields are marked *