Hey all, I'm writing a program which saves the output to a single file like "output.txt"
I've been playing with the ios::nocreate and ios::noreplace but I can't get it to quite do what I want it to do (and yes I've included the #include <iostream> to activate them.
What I'm trying to do is this:
I want the program to save a given output as "output.txt"
If on subsequent runs, when the file is created again I want it to call the file "output1.txt" or "output2.txt" or whatever so that it never overwrites a previous output.
I've done something like this using a NAWK script with a simple for loop and a function while would return a 0 or 1 for the state if a given file exists, but I need this one to be in the executable and I haven't found the function.
Can anyone point me in the right direction?
Thanks!
Czar24
I've been playing with the ios::nocreate and ios::noreplace but I can't get it to quite do what I want it to do (and yes I've included the #include <iostream> to activate them.
What I'm trying to do is this:
I want the program to save a given output as "output.txt"
If on subsequent runs, when the file is created again I want it to call the file "output1.txt" or "output2.txt" or whatever so that it never overwrites a previous output.
I've done something like this using a NAWK script with a simple for loop and a function while would return a 0 or 1 for the state if a given file exists, but I need this one to be in the executable and I haven't found the function.
Can anyone point me in the right direction?
Thanks!
Czar24