fstream not working
I'm trying to use fstream, but I can't get it to work. Nothing happens at all. This is what I have.
Is a new file supposed to be created if there isn't already one? When it wasn't working, I created a new file just in case, but that didn't help any.
testFile << "test";
No file is created, and when I put a file there by that name the file doesn't get the output.
You are using a relative path. The directory that the file is created in depends on the current directory at the time you run your program. Try it with an absolute path (like "C:/text.txt"). If that works, then you just have to figure out which directory the file is being created in when it is relative.
Thanks much. Your debug idea got me to use the computer's search feature, and I ended up finding that the file was being created in the directory my compiler is in, since I was running the file from the compiler's program.
When I run the program itself rather than telling the compiler to run it, it does save to the proper location. So apparently I don't have much of a problem at all; I'll just have to keep that folder open and run it from there from now on.