get file path using "cin" (string or other)

Hello,

I'm supposed to read data from a file on my disk and manipulate it. The thing is, that the file location is predetermined on my hard disk.
How can I specify the file path? I read a similar example but not quite identical, the code goes as:

string filepath;
inData.open(filepath+".path", .... ), I tried this but didn't seem to get it right.


Thanks.
Last edited on
You'll need to get a C string out of the C++ string:
inData.open ( ( filepath+".path" ).c_str(), .... )

http://www.cplusplus.com/reference/string/string/c_str/
Just to double check Bazzy is assuming that the file name ends in a '.path' extention, is this correct?
excuse me guys i've been away...
well yes i used filepath+".txt"...
Topic archived. No new replies allowed.