View Single Post
Wyatt
Veteran Member
 
Join Date: Mar 2005
Location: Near Indianapolis
 
2007-05-03, 14:25

I'm really sick of having to type out absolute paths to files in my C++ programs and then having to delete them when I send them to my professor, who uses Windows (Visual Studio wants relative paths).

Is there any way I can force my programs to use relative paths?

Here's what I'm having to type now:
Code:
infile.open("/Users/myusername/Desktop/folder/file.dat");
I'd much rather type:
Code:
infile.open("file.dat");
This is really the only problem I have in this class, and I just spent the last 30 minutes trying to figure out why my program wasn't writing to a file when the only problem was a mistake in the file path. (Yeah, that sounds stupid, but I'm running on about an hour of sleep today.)

Is there a quick line of code I can plug in? Or, even better, a preference in XCode that I'm missing? Ideally, I'm looking for a preference in XCode, but I'd settle for a preprocessor directive or a couple quick and dirty lines of code I can plug in somewhere.

Twitter: bwyatt | Xbox: @playsbadly | Instagram: @bw317
  quote