File Opening:
-
I am trying to open a new file using Append mode in C++. But file is not opened. If I use out mode, file is opened.But the problem is: The data I entered once is lost during the next execution. I don't want the data to be lost. How to achieve this in C++. Is there any specific mode in C++ for this?
-
I am trying to open a new file using Append mode in C++. But file is not opened. If I use out mode, file is opened.But the problem is: The data I entered once is lost during the next execution. I don't want the data to be lost. How to achieve this in C++. Is there any specific mode in C++ for this?
-
I am trying to open a new file using Append mode in C++. But file is not opened. If I use out mode, file is opened.But the problem is: The data I entered once is lost during the next execution. I don't want the data to be lost. How to achieve this in C++. Is there any specific mode in C++ for this?
open the file in apppend mode... syntax... modes for opening a file-----> fstream file_op("C:\\s1.txt ",ios::out|ios::app);
-
You haven't said what you're using for file handling. Are you using WIN32 handles, stdio FILE*, or STD streams?
Steve S Developer for hire
fstream ofs("studfile.txt",ios::out); This is the statement I'm using to open the file. If I use app in place of out, the file is not opened. But I want the contents of the files don't get erased after each execution.
-
open the file in apppend mode... syntax... modes for opening a file-----> fstream file_op("C:\\s1.txt ",ios::out|ios::app);
Thanks Mani. It's working.
-
You haven't said what you're using for file handling. Are you using WIN32 handles, stdio FILE*, or STD streams?
Steve S Developer for hire
Steve S wrote:
...or STD streams?
STL?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
fstream ofs("studfile.txt",ios::out); This is the statement I'm using to open the file. If I use app in place of out, the file is not opened. But I want the contents of the files don't get erased after each execution.
T.RATHA KRISHNAN wrote:
If I use app in place of out...
Why aren't you using both?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
-
I am trying to open a new file using Append mode in C++. But file is not opened. If I use out mode, file is opened.But the problem is: The data I entered once is lost during the next execution. I don't want the data to be lost. How to achieve this in C++. Is there any specific mode in C++ for this?