Open File for Writing, Relative Path Given On Runtime

How will go on to doing this I have a general idea. But don't know well how it make it work for my project. Runtime means I am going to have to give the path at the command line?

Here is how I have to run it, so I can test it against the example inputs and outputs they give us to test our program. I am using putty. Already crated the folders inside my project folder, but don't know how to implement it on my source code.

./movie_stats < ./input/test1.in ./my-output/test1.out

What I'm thinking is to open/create the file test1.out in the my-output folder and open it at runtime?
Last edited on
So you're saying that you would have a folder called "my-output" in the same directory as your program, and you want to read a file from that location?

ifstream fin ( "my-output/test1.out" ); should work.
Topic archived. No new replies allowed.