Go4Expert

Go4Expert (http://www.go4expert.com/)
-   MFC (http://www.go4expert.com/forums/mfc/)
-   -   ansi mode (http://www.go4expert.com/forums/ansi-mode-t2677/)

Frank Reich 24Jan2007 06:50

ansi mode
 
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.

shabbir 24Jan2007 08:27

Re: ansi mode
 
There is nothing called ANSI mode but there is something called ASCII mode and unicode mode. Do you mean the ASCII mode ??.

Frank Reich 24Jan2007 08:41

Re: ansi mode
 
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.

shabbir 24Jan2007 08:56

Re: ansi mode
 
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.

Frank Reich 24Jan2007 09:04

Re: ansi mode
 
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 :(

Frank Reich 24Jan2007 09:12

Re: ansi mode
 
i think this is the solultion:
http://www.thescripts.com/forum/thread458533.html


All times are GMT +5.5. The time now is 08:03.