Thread: setting msvc 6 to use unicode strings

  1. #1
    Registered User
    Join Date
    Oct 2003
    Posts
    50

    setting msvc 6 to use unicode strings

    hey,

    is it possible to make msvc6 interpret all literal strings in the code as unicode strings? if i #define UNICODE then all the literal strings blow up.

    thanks.

    (edit: without using the TEXT() macro. i'm trying to save time )
    Last edited by reanimated; 01-01-2004 at 10:46 AM.

  2. #2
    Registered User
    Join Date
    Nov 2003
    Posts
    161
    try L before the string e.g.

    something = L "some string"

    "L" is for Literal

    hope that helps?

  3. #3
    Registered User
    Join Date
    Oct 2003
    Posts
    50
    i guess i didn't explain myself properly. a friend came up with a solution, but thanks for trying anyway

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Share the solution with everyone

    gg

  5. #5
    King of the Internet Fahrenheit's Avatar
    Join Date
    Oct 2001
    Posts
    128
    Yes, please do

  6. #6
    Registered User
    Join Date
    Oct 2003
    Posts
    50
    oh, sure. its actually really simple and not particulary good.

    what i had was this situation:

    i had lots of existing code using literal strings, eg:
    Code:
     SetName( "bob", "smith");
    (btw, am i right calling these literal strings?)
    I wanted to convert to unicode, since most pcs now use winXP.
    so, i needed to change this to:
    Code:
     SetName(TEXT("bob"). TEXT("smith"));
    the solution? initially find and replace . I am also working on a program that will read .cpps and change all its strings correctly, hopefully leaving things such as #include "resource.h" intact. I could post it here when its done. tis a shame MSVC can't be made to do it automatically though when the -UNICODE compile option is used.

  7. #7
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Now when someone stumbles on to this thread, they may learn something

    For those wondering, the TEXT() macro will put an "L" in front of the string literal parameter if _UNICODE is defined - making it a wide character string.

    I've had to port my code to CE in the past, a prgram like that would've been nice to have at the time

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. damn strings
    By jmzl666 in forum C Programming
    Replies: 10
    Last Post: 06-24-2002, 02:09 AM
  2. Unicode
    By bigSteve in forum C Programming
    Replies: 1
    Last Post: 05-22-2002, 10:29 AM
  3. menus and strings
    By garycastillo in forum C Programming
    Replies: 3
    Last Post: 04-29-2002, 11:23 AM
  4. No one Knows About AnsiStrings
    By Unregistered in forum C++ Programming
    Replies: 3
    Last Post: 04-23-2002, 11:21 PM