Originally Posted by
Eman
@CommonTater, I don't know why but I can't compile your code..it says unresolved reference to PathUnquotesA..
And what your program does sounds really cool
Ok... in the linker's list of libraries add shlwapi.lib ... I'm currently using code:blocks with MSVC++ so there's a dialog for that. Perhaps one of the others can explain how to do it on the command line for GCC...
EDIT: Forgot to mention, that's a windows header so you may have to download the Windows SDK to get it... sorry.
when every function is called, it saves its parameters to the stack.
So the main(int argc, char **argv) saves the number of parameters and the address of the first element (of pointers) to the stack. So I should be able to do a loop and cout (I say cout because I don't know how else it could be used) the names of the parameters.
I don't see the point of accessing the arguments in main, and i think it is because I don't know the use of it.
But CommonTater just showed how useful it is.
Ok... look at my source code... follow those parameters step by step...
Code:
if (!strcmp(argc[1],"-R") || (!strcmp(argc[1],"-r")))
{ Shuffle = true;
if (argc[2])
Target = argc[2];
if (argc[3])
Folder = argc[3]; }
else
{ if(argc[1])
Target = argc[1];
if (argc[2])
Folder = argc[2]; }
Notice how I'm copying them into other variables? Which ones I put where depends how many there are... Target is the output filename, Folder is the directory to be examined, Shuffle is the switch to tell it whether to list files in sorted or randomized order...
Then..
Code:
DirList(Folder); // reads the directory into a string vector
DirList.SaveList(Target); // writes the list to a file
The values of Folder and Target used in those functions came from the command line.
The way you use CLI parameters will vary from program to program. What you need to know is that within Main these are valid string variables that you can use within your code.