long path names for ifstream in(

G

Gary Wessle

hi
opening a file
ifstream in("../../../../../../data/ZB/Jun06/20060405");

then on the command line I do
fred@debian:~/myPrograms/cpp/practice/ticpp1/co2/3$ make; ./proj

is there a way to save some typing and cleaner than this.

thanks
 
M

mlimber

Gary said:
hi
opening a file
ifstream in("../../../../../../data/ZB/Jun06/20060405");

then on the command line I do
fred@debian:~/myPrograms/cpp/practice/ticpp1/co2/3$ make; ./proj

is there a way to save some typing and cleaner than this.

Put the "../.." part in a std::string (or macro, yuck!) and prepend it
to all appropriate file names? Use the absolute path? Put a link to the
data directory in your executable directory? Require that the user run
the executable from a certain location so you can use relative paths?
Etc. etc. etc.

Cheers! --M
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top