Turn off unicode using pragma or something inside the code itself?

Hello, I'm using Visual C++ 2005 and I was wondering if you can use a #pragma or something inside the code itself to turn off unicode I know you can do it manually from inside the IDE by going to Project->Properties->Configuration Properties->General and there setting Character Set to "Not Set", but I'd like to do it from the code itself if possible. Similar to linking in non-standard libs by doing #pragma comment(lib, libname) (if I remember that one correctly).


Answer this question

Turn off unicode using pragma or something inside the code itself?

  • amitvjti

    I'm terribly sorry, but this does indeed seem to work. Just make sure the #undefs comes before any includes of system headers.

  • Tech Applyyourself

    It doesn't work I'm afraid. I already tried it, actually, should've mentioned it in my first post, sorry. The two #undef:s doesn't have any effect on the compiler output.

  • wim_

    You could do this :-

    #undef UNICODE
    #undef _UNICODE

    mindcooler wrote:
    Hello, I'm using Visual C++ 2005 and I was wondering if you can use a #pragma or something inside the code itself to turn off unicode I know you can do it manually from inside the IDE by going to Project->Properties->Configuration Properties->General and there setting Character Set to "Not Set", but I'd like to do it from the code itself if possible. Similar to linking in non-standard libs by doing #pragma comment(lib, libname) (if I remember that one correctly).



  • Turn off unicode using pragma or something inside the code itself?