Just started learning C++ and my knowledge is quite basic on IT. I am using VC 2010.
How can I tell my code where to look for input files? Is there a way to tell the compiler to look for input files into a prespecified list of directorie开发者_开发问答s, e.g. M:/Test, M:/Project, etc.
I know I can add the whole path to a file in the code, change working directory through chdir, setting working directory in the dialog windows of VC++. The last two enable me to specify only one working dir at the time while i would like to specify n directories where to look for files.
If you want your program to look for files in different directories, you have to write the code to do so.
Or you need to pass in the full paths to your different data files.
There is no standard C++ function to "find a file in a set of directories".
In VC 2008 you can go to Tools->Options->Projects and Solutions. Here you can specify directories to seach for executables, include and library files. I think you can find something like that in VC 2010, too.
精彩评论