C
coolchap
Hi,
My requirement is to create a new text file as an output of a C+
+ program (for eg Output.txt), if the Output.txt file already exists,
then the data needs to be appended to the existing file.
Is there a way to check if a file exists before opening the file with
ofstream ?
I have seen that we can append using outputFile.open("filename.dat",
ios::app), but am not so sure about checking if the file exists before
writing into it.
Regards,
Prashant
My requirement is to create a new text file as an output of a C+
+ program (for eg Output.txt), if the Output.txt file already exists,
then the data needs to be appended to the existing file.
Is there a way to check if a file exists before opening the file with
ofstream ?
I have seen that we can append using outputFile.open("filename.dat",
ios::app), but am not so sure about checking if the file exists before
writing into it.
Regards,
Prashant