Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 382
  • Last Modified:

How to Append or Write to File?

I am a C++ programmer and I am having problems writing some simple code in C.  I am trying to dtermine if a file exists if it does I would like to append to that file if not I would like create another file to write to.  The file names for each are the same.  The file at question may be removed from time to time that is why I am trying to do this.
0
hawhite
Asked:
hawhite
1 Solution
 
rayray120497Commented:

try to use

fopen( filename, "a" )

using the mode "a" - means append.
if the file does not exist, it will be created.
I believe this is exactly what you want
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Firewall Management 201 with Professor Wool

In this whiteboard video, Professor Wool highlights the challenges, benefits and trade-offs of utilizing zero-touch automation for security policy change management. Watch and Learn!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now