Need help creating a comand prompt.

Discussion in 'C' started by ssjdbz101, Sep 1, 2007.

  1. ssjdbz101

    ssjdbz101 New Member

    Joined:
    Sep 1, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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.
     
  2. DaWei

    DaWei New Member

    Joined:
    Dec 6, 2006
    Messages:
    835
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Semi-retired EE
    Location:
    Texan now in Central NY
    Home Page:
    http://www.daweidesigns.com
    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.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice