Solved

How to Append or Write to File?

Posted on 1998-06-24
1
359 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to set environment variables in C 2 78
Trouble linking program with -lcrypt 3 141
Why does module make constant click noise ? 9 125
convert char array to number in c 5 83
Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

911 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

23 Experts available now in Live!

Get 1:1 Help Now