What is the meaning of 'wt' in utf8_fopen

S

silverburgh.meryl

Hi,

Can you please tell me what is the mean of 't' in the input parametre
in utf8_fopen?

utf8_fopen( a_file, "wt" )

Thank you.
 
V

Victor Bazarov

Can you please tell me what is the mean of 't' in the input parametre
in utf8_fopen?

utf8_fopen( a_file, "wt" )

Not sure what the heck 'utf8_fopen' is, but in 'fopen' "wt" means
open for Write in Text mode.

V
 
D

Default User

Victor said:
Not sure what the heck 'utf8_fopen' is, but in 'fopen' "wt" means
open for Write in Text mode.

No, it's undefined.

From the C draft standard:


7.19.5.3 The fopen function

Synopsis

[#1]

#include <stdio.h>
FILE *fopen(const char * filename,
const char * mode);


[#3] The argument mode points to a string. If the string is
one of the following, the file is open in the indicated
mode. Otherwise, the behavior is undefined.214)

r open text file for reading
w truncate to zero length or create text file for writing
a append; open or create text file for writing at end-of-
file
rb open binary file for reading
wb truncate to zero length or create binary file for
writing
ab append; open or create binary file for writing at end-
of-file
r+ open text file for update (reading and writing)
w+ truncate to zero length or create text file for update
a+ append; open or create text file for update, writing at
end-of-file
r+b or rb+ open binary file for update (reading and writing)
w+b or wb+ truncate to zero length or create binary file for update
a+b or ab+ append; open or create binary file for update, writing
at end-of-file


214If the string begins with one of the above sequences, the
implementation might choose to ignore the remaining
characters, or it might use them to select different
kinds of a file (some of which might not conform to the
properties in 7.19.2).



Brian
 
V

Victor Bazarov

Default said:
Victor said:
Not sure what the heck 'utf8_fopen' is, but in 'fopen' "wt" means
open for Write in Text mode.

No, it's undefined.

From the C draft standard:
[..]

Whatever. The "wt" still looks very much like
"open for WRITE in TEXT mode".

V
 
J

James Kanze

Default said:
Victor Bazarov wrote:
(e-mail address removed) wrote:
Can you please tell me what is the mean of 't' in the input
parametre in utf8_fopen?
utf8_fopen( a_file, "wt" )
Not sure what the heck 'utf8_fopen' is, but in 'fopen' "wt" means
open for Write in Text mode.
No, it's undefined.
From the C draft standard:
[..]
Whatever. The "wt" still looks very much like
"open for WRITE in TEXT mode".

But who cares what it looks like. "wt" is undefined behavior
when passed to fopen. A quick search on the net turned up several
different utf8_fopen; it's also undefined behavior in at least
several of them.

Text mode is signaled by the absense of a "b" in the mode, not
by the presense of anything else.
 
I

Ismo Salonen

James said:
Default said:
Victor Bazarov wrote:
(e-mail address removed) wrote:
Can you please tell me what is the mean of 't' in the input
parametre in utf8_fopen?
utf8_fopen( a_file, "wt" )
Not sure what the heck 'utf8_fopen' is, but in 'fopen' "wt" means
open for Write in Text mode.
No, it's undefined.
From the C draft standard:
[..]
Whatever. The "wt" still looks very much like
"open for WRITE in TEXT mode".

But who cares what it looks like. "wt" is undefined behavior
when passed to fopen. A quick search on the net turned up several
different utf8_fopen; it's also undefined behavior in at least
several of them.

Text mode is signaled by the absense of a "b" in the mode, not
by the presense of anything else.

--
James Kanze (GABI Software) email:[email protected]
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Well, in Microsoft implementations the 't' can be used to specify text
mode. In libraries and dll's it is good practice because the other parts
can change the default filemode with globa (yikes) _fmode or using
binmode.obj with linker.

But in any case the utf8_open is not part of standard so this
discussion is OT here.

ismo
 
D

Default User

Victor said:
Default said:
Victor said:
(e-mail address removed) wrote:
Can you please tell me what is the mean of 't' in the input
parametre in utf8_fopen?

utf8_fopen( a_file, "wt" )

Not sure what the heck 'utf8_fopen' is, but in 'fopen' "wt" means
open for Write in Text mode.

No, it's undefined.

From the C draft standard:
[..]

Whatever. The "wt" still looks very much like
"open for WRITE in TEXT mode".

Perhaps it does, but it isn't. You of all people should appreciate the
difference between "what is" and "what looks like".




Brian
 
V

Victor Bazarov

Default said:
Victor said:
Default said:
Victor Bazarov wrote:

(e-mail address removed) wrote:
Can you please tell me what is the mean of 't' in the input
parametre in utf8_fopen?

utf8_fopen( a_file, "wt" )

Not sure what the heck 'utf8_fopen' is, but in 'fopen' "wt" means
open for Write in Text mode.

No, it's undefined.

From the C draft standard:
[..]

Whatever. The "wt" still looks very much like
"open for WRITE in TEXT mode".

Perhaps it does, but it isn't. You of all people should appreciate the
difference between "what is" and "what looks like".

How do you know it _isn't_? What's 'utf8_fopen'? I don't know such
function. I speculated (implicitly) that it is akin to 'fopen', which
has similar arguments. I incorrectly recalled that 'fopen' allows the
second argument to be "wt". It does NOT preclude 'utf8_fopen' to allow
"wt" which DOES look like "open for WRITE in TEXT mode".

More objections?

V
 
D

Default User

Victor said:
Default said:
Victor said:
Default User wrote:
Victor Bazarov wrote:

(e-mail address removed) wrote:
Can you please tell me what is the mean of 't' in the input
parametre in utf8_fopen?

utf8_fopen( a_file, "wt" )

Not sure what the heck 'utf8_fopen' is, but in 'fopen' "wt"
means open for Write in Text mode.

No, it's undefined.

From the C draft standard:
[..]

Whatever. The "wt" still looks very much like
"open for WRITE in TEXT mode".

Perhaps it does, but it isn't. You of all people should appreciate
the difference between "what is" and "what looks like".

How do you know it isn't? What's 'utf8_fopen'? I don't know such
function. I speculated (implicitly) that it is akin to 'fopen', which
has similar arguments. I incorrectly recalled that 'fopen' allows the
second argument to be "wt". It does NOT preclude 'utf8_fopen' to
allow "wt" which DOES look like "open for WRITE in TEXT mode".

I'm unconcerned about utf8_fopen() because it's nonstandard. I have no
opinion about what "wt" or any other argument may or may not do. And in
fact, I never addressed it, and you know that. I corrected your error
about fopen().

I'm not sure why you're being so pissy about this. You spend a good bit
of your time here correcting other people's mistakes, some less
egregious than yours. I'd have expected a bit more graciousness on your
part. Something akin to, "thanks for the information", not, "whatever".




Brian
 
D

Default User

Victor said:
Default said:
[..moan moan..]

Thanks for the information.


I'm sorry you feel so put upon by a simple correction of your mistake.
You know, the FAQ doesn't say anything about Victor Bazarov always
being right, or if he's wrong it not being important.

I'm sure you'll take it in stride next time someone is rude and
ungracious when you point out one of their errors.




Brian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,294
Messages
2,571,511
Members
48,201
Latest member
JefferyBur

Latest Threads

Top