I wrote a c++ program that reads in some data files in the current directory. After user input it will also generate an output file in the current directory.
It works fine, until I try to put it on a webserver. All the directory address stuff gets out of hand and nothing works. Doesn't seem like there is a lot of help on the net.
My questions are:
- Is there a way to link these data files directly to the program itself? They aren't very big, about 20MB. This way I can skip over the directory addressing problem.
- How do I get the program to output the file into a specific directory, rather than just it's current directory? I'd like to store files into a subfolder, for example.
I use fstream for the input files and ostream/filebuf for the output file.
Thank you in advance.
For question 1, if it is not possible, how do I force the program to look for these data files in the directory of the program file itself, rather than the start location? I'm using JSP to call the program via system command line.