Ofstream is not making an output file

Pages: 12
You could try asking the program to give you a little more information:

1
2
3
4
5
6
7
8
9
#include <cstdio> // For perror().
...
    if( !output)
    {
        // std::cerr writes (typically error messages) to the standard error stream stderr (unbuffered)
        // https://en.wikipedia.org/wiki/Stderr
        std::cerr << "*** error: could not open output file\n" ;
        perror("Output file failed to open because: ");
    }


Last edited on
Ok I tried something today where I replaced the code in the solution that is printing an output with the code that we've been discussing thus far and it finally worked!

Not too sure as to why though :S They both are in seperate directories, however they are both in the C drive so not sure if that affects it?

Any how now I might need help in regards to my program to take in a file, read the first 100 lines and remove the last two characters. And repeat for x amount of files. I tried the output today and it only printed the first file's 100 lines.
Last edited on
Topic archived. No new replies allowed.
Pages: 12