Click here to Skip to main content
15,894,646 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I want to create a file if its not exist and nees to open it in append mode.
so fopen with "a+" works for creation and appending a file?

Help me out.
Thanks in advance.
Posted
Updated 2-May-10 19:34pm
v2

1 solution

Poonamol wrote:
fopen with "a+" works for creation and appending a file

Yes!

"a+": Open a file for reading and appending. All writing operations are performed at the end of the file, protecting the previous content to be overwritten. You can reposition (fseek, rewind) the internal pointer to anywhere in the file for reading, but writing operations will move it back to the end of file. The file is created if it does not exist.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900