Using FILE class to write into txt file in DOS Codepage
I'm using
CString text;
CString file_name;
text = "My text.";
file_name = "MyFile.txt";
FILE *fp;
fp = fopen(file_name, "w+");
fprintf(fp, text + "\n");
fclose(fp);
There will be MyFile.txt in Windows codepage.
How to write to txt file with DOS codepage?
Re: Using FILE class to write into txt file in DOS Codepage
>> text = "My text."
Those characters have the same code points in all encodings. What characters are you trying to write that are different in the OEM codepage vs ACP codepage?
gg
Re: Using FILE class to write into txt file in DOS Codepage
Instead of "My text." will be another text.
I can not give you that text.
I must to safe in two txt files:
1. With MS-DOS Encoding.
2. With MS-Windows Encoding.
Re: Using FILE class to write into txt file in DOS Codepage
Which DOS encoding? Which "Windows" encoding?
In my locale, the DOS encoding is 437 and my ACP is 1252.
gg
Re: Using FILE class to write into txt file in DOS Codepage
Re: Using FILE class to write into txt file in DOS Codepage
Thank you.
Which OS do you use?
Re: Using FILE class to write into txt file in DOS Codepage
CharToOem coverts an ACP encoding into an OEM encoding. The actual codepage depends on the locale. For me, OEM=437 and ACP=1252.
I'm running Win7 with a US locale. Other locales will have different ACP/OEM codepages.
gg
Re: Using FILE class to write into txt file in DOS Codepage
Thank you.
By the way, could you tell me, which instrument must be used to create some bare metal utilities and OS ?
Quote:
Originally Posted by
Codeplug
CharToOem coverts an ACP encoding into an OEM encoding. The actual codepage depends on the locale. For me, OEM=437 and ACP=1252.
I'm running Win7 with a US locale. Other locales will have different ACP/OEM codepages.
gg
Re: Using FILE class to write into txt file in DOS Codepage
>> ... which instrument must be used to create some bare metal utilities and OS ?
It may be better if you state exactly what you're trying to achieve. I don't know what "bare metal" means.
gg
Re: Using FILE class to write into txt file in DOS Codepage
It means without starting operating system (OS) or without installed OS.
Quote:
Originally Posted by
Codeplug
>> ... which instrument must be used to create some bare metal utilities and OS ?
It may be better if you state exactly what you're trying to achieve. I don't know what "bare metal" means.
gg