Alright, I don't have any code for this one cause I've yet to start it, I just want to clear a few things up before I figure out how I do it. I'll note now that I'm struggling with how to explain this and I may end up repeating the same points or droning on and on about nothing. Be warned.
As with my last command line post, this is dealing with files, but now I want to add some functions that allow you to manipulate parts of files, such as replacing words, cutting them down to a certain size (by the way, I may have later questions in this as I want people to be able to cut down files by number of bytes if they wish), and other things to manipulate them.
The thing I'm not sure about is, would I be allowed to pass all command line arguements to a function in a function call and how would it be done. Basically, the main program will decide what the person is trying to do up until argv, then it will pass the action of how to handle it to the function.
...but in the function, I may need to send the rest of the command line arguements to it so it can handle them appropriately. Let me give an example of user input:
That's a lot of aguements being passed. The way I want the program to handle it is in main() have a if statement for argv and depending what that is, call the appropriate function and pass the arguements to it. Now, what I'm hoping you're gonna tell me is this:Code:C:\ > fileManip replace "January 15th" "Febuary 12th" all report.txt Where the format would this is: fileManip replace <word(s) to replace> <word(s) to replace with> <starting instance(or all)> <ending instance(if not all)> <filename or pathname>
Is it that simple to pass the arguements with no problems?Code:if (strcmp(argv, "replace") == 0) replace(argv); // The function call passing the arguements
Alright... I'll stop here with that question. I have more but I'll give you this one first and maybe post the rest in replies.