Odd behavior of fopen with ccs option

  • Thread starter Thread starter PLS
  • Start date Start date
P

PLS

I'm puzzled about the behaviour of fopen with the ccs= options. The
table below iswhat I'm seeing. I am opening a file with the fopen option
shown, then writing to it with fputws. What I want to happen it to read
either Ascii or Unicode files as Unicode, but to write the files as
Unicode when it is a new or compiletely overwritted file. Reading works
fine, writing does not.


Existing fopen Resulting
File option File
---------------------------------------------------
No file w+tS, ccs=UNICODE Ascii
No file wtS, ccs=UNICODE UTF-16LE
Ascii w+tS, ccs=UNICODE Ascii
Ascii wtS, ccs=UNICODE UTF-16LE
Unicode w+tS, ccs=UNICODE Ascii
Unicode wtS, ccs=UNICODE UTF-16LE


I do not understand why "w+" would be different from "w". Why does it
work this way?

Thanks,
++PLS
 
It looks to me like several programmers were involved in coding the fopen
and fwrite routines. It looks to me like different programmers read
different parts of the MSDN page that specifies fopen.
 
Back
Top