ansi mode

Discussion in 'MFC' started by Frank Reich, Jan 24, 2007.

  1. Frank Reich

    Frank Reich New Member

    Joined:
    Nov 28, 2006
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    0
    Hi.

    I am having a standard SDI application that must be modified to be ANSI mode. How or where should I this modification?

    Thanks.
    F.R.
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    There is nothing called ANSI mode but there is something called ASCII mode and unicode mode. Do you mean the ASCII mode ??.
     
  3. Frank Reich

    Frank Reich New Member

    Joined:
    Nov 28, 2006
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    0
    Dear Shabbir,

    thanks for the reply! well the problem i am facing is as follows (written in a SDI application):
    Code:
    char buf    [MAX_PATH+2];
    GetModuleFileName(NULL,(LPWCH)buf,MAX_PATH);
    std::stringstream folder;
    folder << buf;
    this code above won't work, as LPWCH is a pointer to a unicode sign, and buf is a 'normal' character. so i got the advice to change the project to be ANSI mode. but as it seems it should be ASCII, like you said it in your post. so how can i change it to be ASCII?

    THANKS!
    F.R.
     
  4. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Either go for everything in ASCII or unicode.

    I would like to know what is the procedure you are building your application. Is it in unocde or normal ASCII. It looks like it is normal ASCII because you are using char and not WCHAR

    What I meant is dont type cast to LPWCH but some its equivalent in ASCII and it should be some thing like LPCH but you should check out the MSDN or try using the WCHAR instead.

    If you use WCHAR but then also compile in normal ASCII mode I would suggest you the T version. TCHAR which automatically maps to the correct version you are building your application.
     
  5. Frank Reich

    Frank Reich New Member

    Joined:
    Nov 28, 2006
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    0
    Yes, I assume I am using everything in ASCII, because I don't use anything like WCHAR or wstring or whatever.

    i used 'wchar_t' instead but it didn't work either. what i just would like to do is to save the path of my program into a stringstream. i don't know why it seems so difficult :(
     
  6. Frank Reich

    Frank Reich New Member

    Joined:
    Nov 28, 2006
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    0

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice