Thursday, 5 September 2013

Reading a string in as a txt file name in c++

Reading a string in as a txt file name in c++

So I have a program that will read in arguments from the command line. One
of my arguments is a text file in the folder. I'm trying to open this txt
file and read the lines in it, but in order to do so I need to put the
specific txt file in double quotes like so: "text.txt". Is there a way to
do this if the text file's name is stored in a string?
by the way, opening the file should look something like this:
std::ifstream text ("textfile.txt")

No comments:

Post a Comment