User forums > Using Code::Blocks

Write in file without deleting its contents

(1/1)

pion:
Hello again,

I have stored some numbers in a text file and I want to read these numbers when starting my program. As far as I know, if I want to use a file in my program, I need to use fopen("file.txt", "w"), which clears the contents of the file. Is there a way to read and write a file without having to delete what's in it first, so that I can use the file to store long term information?

gd_on:
next time, use a general programming forum, not this one !
For example have a look in https://www.tutorialspoint.com/c_standard_library/c_function_fopen.htm

pion:
Sorry, I didn't know this was only for Codeblocks questions. I think I found an answer to my problem, thanks!

Navigation

[0] Message Index

Go to full version