473,473 Members | 1,707 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Odd behavior of fopen with ccs option

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
May 24 '07 #1
1 2517
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.

"PLS" <no****@nowhere.comwrote in message
news:MP***********************@msnews.microsoft.co m...
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
May 24 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: clusardi2k | last post by:
Hello, I have a shared drive on SGI, Linux, and Windows. The fact that I'm using a shared drive may be mute information. The problem is within the same program a second call to fopen does not...
1
by: francescomoi | last post by:
I'm trying to read a file with PHP: -------------------- $fileToRead = "foo.txt"; //Option-1 #$fileToRead = "/home/frank/otherdir/foo.txt"; //Option-2 $dataFile = fopen($fileToRead, "r") ;...
15
by: tschi-p | last post by:
maybe my question is quite simple, but although searching like wild I cannot find a solution. I just want to append to a file, let's say to "c:\my folder\filename1.txt". Normally with...
7
by: Justin Koivisto | last post by:
system: php 4.4.2 windows 2003 server apache 1.3.x problem: scripts don't work :-P description:
9
by: Chad | last post by:
The input file is: Params 1 2 3 4 5 6,7 Data 1,1
111
by: Nate | last post by:
Hello, I am looking for a method to automatically declare variables in C. I'm not sure if there is a good way to do this, but I had something like this in mind... int i; for(i = 1; i < 4;...
10
by: Julia | last post by:
Hi, there, I am trying to append a binary file by using: FILE *strean; stream = fopen( "c:\temp.dat", "ba+" )); Is there a way that I can check if the file exists or not before fopen,...
28
by: v4vijayakumar | last post by:
#include <string> #include <iostream> using namespace std; int main() { string str; str.resize(5); str = 't';
31
by: Bill Cunningham | last post by:
Is there a real difference in r+ and w+ ? I read in my man pages that r+ opened a file for reading and writing while w+ opened a file for reading and writing and if the file didn't exist it would...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.