Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Need help creating a comand prompt. (http://www.go4expert.com/forums/help-creating-comand-prompt-t6153/)

ssjdbz101 1Sep2007 23:04

Need help creating a comand prompt.
 
I haven't done any programming in five years, (plus I don't like it enough to go and review my old class notes) and I have to create a DOS-like command prompt using C++ for my last Computer Science class, and I need help.

I have to get the following commands to work when entered: RUN filename, LIST, LIST filename, COPY oldfile newfile, HELP, QUIT.

I know how to to make some of the commands do what they're supposed to (help, quit), but I don't know how to create the whole command prompt shell idea, essentially, how do I make it so that what the user puts in is done, and how to distinguish between the entered commands?
Ex: when the user types "RUN filename", how do I get this to 'run filename', and separate this from the other commands entered?

Also, how do you determine between commands like "COPY this that", which copies the file 'this' to the newly created file 'that', and "COPY this"? The number of words stumps me.

Any and all help would be greatly appreciated.

DaWei 2Sep2007 00:05

Re: Need help creating a comand prompt.
 
Review the command line tokens that are passed to main when you define it thusly:

int main (int argc, char *argv[])

We will be happy to help you with your code, but it is unlikely that anyone will write it for you.


All times are GMT +5.5. The time now is 00:38.