Click here to Skip to main content
14,735,271 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

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.
Updated 2-May-10 20:34pm

1 solution

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


"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.

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