Solved

How to Append or Write to File?

Posted on 1998-06-24
1
357 Views
Last Modified: 2010-04-15
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
Comment
Question by:hawhite
1 Comment
 

Accepted Solution

by:
rayray120497 earned 50 total points
ID: 1251403

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

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now