Re: [Dev-C++] How to find out code page in DOS Command Prompt
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Per W. <pw...@ia...> - 2007-05-02 09:29:46
|
First of all system("") basically starts a new console for running the
command. I'm not sure if you can guarantee that the new environment
inherrits every characteristic from your application.
Second - the cp variable is not the answer for the chcp command. It is the
return value. In this case, a value of 0 means that the command executed
ok. It corresponds to the value you send to the function exit(), or the
return value when you leave the main() function.
When you use system() to run a command, that command will emit it's
answers to stdout - i.e. it will print the information. Not return it as
a value for system() to return.
Go to the Microsoft MSDN web site. They have a complete reference of the
Win32 API. There, you can find a huge amount of functions that you can
call directly from your code. Real functions, producing real answers.
There, you have a lot of information about current locale, code pages etc.
/pwm
On Wed, 2 May 2007, Jan Mura wrote:
> Hello,
>
> I would like to ask if there is a way to find out which code page
> iscurrently set for Command Prompt in Windows (I use XP Prof).
>
> I have tried to use somthing like
>
> ...
> cp = system("chcp");
> printf ("%d", cp);
>
>
> But there is always 0 in return value cp.
> The return values should be an implementation defined. So are they
> implemtented in Windows? Did I a mistake?
>
> Thank you.
>
> Jan Mura
> jan...@vo...
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|