Handling spaces in command line arguments
A question which I hope isn't too silly or naive but one that is pulling my hair out.
I'm passing arguments to main, no big deal. The first argument that I'm passing is a directory where input txt files need to be processed by my program. Again nothing complicated or anything.
THe problem is windows and specfically spaces that it allows in directory names.
For example, I call my program with the below command lines.
Notice the spaces in the Documents and Settings directory and My Documents.
C:\AutoChar\\autochar_classes.exe C:\Documents and Settings\adminstrator\My documents\turn57
Now I only want to have 1 extra element in argv but because of the spaces, it adds 4 of them. As below:-
So is there any syntax within DOS that I can use so that the spaces are ignored by argv and that it puts the entire command line argument at argv (spaces and alll).
argc = 5
argv = C:\AutoChar\autochar_classes.exe
argv = C:\Documents
argv = and
argv = Settings\adminstrator\My
argv = documents\turn57
If not in DOS, then is there something that I can do within c++.
My problem is that I will have 2 command line arguments. One with be the input directory for input files and the 2nd command line argument will be the directory for output files. Both may contain white space in their names and I won't know for sure when one begins and one ends.
Any suggestions ?