News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Write in file without deleting its contents

Started by pion, September 04, 2021, 11:00:21 AM

Previous topic - Next topic

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

Windows 11 64 bits (25H2), svn C::B (last version or almost!), wxWidgets 3.3.2, Msys2 Compilers 16.1.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (dwarf2, posix  in C:\msys64\mingw32).

pion

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