Thank you Ancient Dragon...I see what you are talking about. The data structure I have which contains strings will be either wchar_t or char depending on whether UNICODE is defined, so it works itself out when using fwrite. Now, having said that, the non-UNICODE version of the application (let's call it wAPP) will thus produce a data file (let's call it wFILE) different from that (let's call it FILE) of the UNICODE version (let call this APP), because of the data structure difference.
This means if I used APP to open wFILE or wAPP to open FILE, I will be in trouble yes? Although I do not see this happening practically, but is there a way to avoid this situation? Is there a way to open a file and find out if it's written one way versus another WITHOUT logic in the application code to add some sort of a version marker in it? I would prefer if there is a way to preserve the current legacy format of FILE and not have to promote the file format just because we will be building a UNICODE version.
Now another question would be even for binary file if I have a structure like:
and I write a bunch of this into the file using fwrite, will the name be encoded differently in the file that is sensitive to the locale settings or no?