|
-
November 13th, 2009, 02:58 PM
#1
Appending Unicode text?
I'm using this to append Unicode text:
Code:
FILE *File = _wfopen( filepath, L"at,ccs=UNICODE" );
This works fine when the Unicode file exists.
However, sometimes the file might not exist, and the Unicode text gets appended without re-creating the
BOM mark at the beginning of the file, which corrupts the file.
Is this how it's suppose to work, or it is a bug?
I don't understand why append mode doesn't just re-create the mark for non-existent files.
-
November 13th, 2009, 10:01 PM
#2
Re: Appending Unicode text?
The BOM is not automatically created.
You will have to write the it yourself at the begining of the file.
-
November 13th, 2009, 11:50 PM
#3
Re: Appending Unicode text?
 Originally Posted by _Superman_
The BOM is not automatically created.
You will have to write the it yourself at the begining of the file.
Thanks for the reply. That's a bummer!
-
November 15th, 2009, 12:51 PM
#4
Re: Appending Unicode text?
Before opening, you can check whether the file exists. If it doesn't exist, you create it, write the BOM and close. Then you proceed with the rest of the your code.
Or you can create your own function, that does all that, and call it instead of each _wfopen call.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|