How to open a file with fstream?

So, I am making this database thing for names(it IS a console application), and I have it where says:

Hello, do you already have a file? (y/n)

And, if you enter 'n', it will make a file for you to enter names in. If you enter 'y', on the other hand, I want it to open the .txt file you made previously. How can I do that? All I have now is I have to go into my projects file (Program Files(x86)//CodeBlocks//Projects//database//data.txt). I could just read the file from my program, but I would like to do it this way, so it seems more advanced, I guess, and, I will have to know it eventually if I ever get a job programming. So... Any help?

Thank you,
AceDawg45
Last edited on
Topic archived. No new replies allowed.