"ab" mode in fopen

P

pereges

Can I use this mode to create a new file , add some data and then
append more data ? How is it different from ab+ ?
 
K

Kenneth Brody

[Critical part of question in subject: "ab" mode in fopen]
Can I use this mode to create a new file , add some data and then
append more data ?
Yes.

How is it different from ab+ ?

"ab" is "append; open or create binary file for writing at end-of-file"
and "ab+" is "append; open or create binary file for update, writing at
end-of-file".

In other words, the difference is that "ab" is write-only, while "ab+"
is read/write.

--
+-------------------------+--------------------+-----------------------+
| Kenneth J. Brody | www.hvcomputer.com | #include |
| kenbrody/at\spamcop.net | www.fptech.com | <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------+
Don't e-mail me at: <mailto:[email protected]>
 
P

pereges

[Critical part of question in subject: "ab" mode in fopen]
Can I use this mode to create a new file , add some data and then
append more data ?
Yes.

How is it different from ab+ ?

"ab" is "append; open or create binary file for writing at end-of-file"
and "ab+" is "append; open or create binary file for update, writing at
end-of-file".

In other words, the difference is that "ab" is write-only, while "ab+"
is read/write.

Then in that case, ab+ is better if you want to do write followed by
read in same function.
 
J

Joachim Schmitz

pereges said:
[Critical part of question in subject: "ab" mode in fopen]
Can I use this mode to create a new file , add some data and then
append more data ?
Yes.

How is it different from ab+ ?

"ab" is "append; open or create binary file for writing at
end-of-file" and "ab+" is "append; open or create binary file for
update, writing at end-of-file".

In other words, the difference is that "ab" is write-only, while
"ab+" is read/write.

Then in that case, ab+ is better if you want to do write followed by
read in same function.
replace 'better' with 'correct' :cool:

Bye, Jojo
 

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

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
DewittMill
Top