Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How to Append or Write to File?

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

Connect further...control easier

With the ATEN CE624, you can now enjoy a high-quality visual experience powered by HDBaseT technology and the convenience of a single Cat6 cable to transmit uncompressed video with zero latency and multi-streaming for dual-view applications where remote access is required.

Question has a verified solution.

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

Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand opening and writing to files in the C programming language.

789 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