Ok well before starting, I'd like to say that I'm not a pro and that I would really appreciate it if I could get precise and well explained answers. (I posted on some other forums and all they did was giving me one or two technics name that I had no idea what they were).
So I have this simple program that reads information from a .txt, does stuff with does numbers, and exports the results to .txt
To INPUT exe, we have to drop the .txt on the .exe
1 2 3 4 5 6 7 8 9 10
|
..........
int main(int argc, char **argv)
{
//Variables
ifstream read;
//Opens the numbers txt
read.open (argv[1]); //Open ifstream
..........
|
To export, it "should" export to same folder as the exe.
1 2 3 4 5 6 7
|
..........
write.open ("results.txt"); //open txt file to write to
xport(); //prints the table in the txt file
write.close(); //close the result file
..........
|
So now, my two problems are:
1. When I use this main parameter to get drag&drop .txt file, the ofstream doesn't work like before... It won't export if I don't put a PRECISE path. Therefore, when I leave it like it is now, it does nothing.
2. I want to be able to see the filename of the .txt, and if possible the path of the .txt too. When I print argv[1], it gives me both at the same time, and I'm not quite sure how I could CUT it in two.
Thanks in advance for the help
~Ph0X