Thread: dos prompt disappearing

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    24
    Well, ive tried making the user input quit to exit:
    Code:
    #include <iostream.h>
    #include <string.h>
    
    char command[99999];
    
    int main()
    {
        cout << "Command>";
        cin.getline(command, 99999, '\n');
        if(!strcmpi("quit", char command)
        {
            return 0;system(command);
            int main();
        }
        
        else
        {
            system(command);
            int main();
        }
    }
    But in Dev-cpp it gives me the errors:

    parse error before `)' token

    parse error before `else'

    But i couldn`t find any missing semicolons, wrong letters, etc.

    And using
    Code:
    cin << command
    instead of using
    Code:
    cin.getline(command, 99999, '\n')
    would make ping 127.0.0.1 to be read by the program as ping.

  2. #2
    Registered User
    Join Date
    Jul 2004
    Posts
    24
    and what`s in the faq doesnt work

  3. #3
    Useless Apprentice ryan_germain's Avatar
    Join Date
    Jun 2004
    Posts
    76
    what version of dev do u use? I wasnt working for me so i upgraded to 4.9.9.0 (the 5 beta or whatever) and it worked

    >>>>>You can also take out int main() inside main and replace by a do while or something.
    There is not the slightest indication that [nuclear energy] will ever be obtainable. It would mean that the atom would have to be shattered at will.

    -Albert Einstein, 1932

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling from DOS Prompt using Visual Studio Express 2005
    By The SharK in forum C++ Programming
    Replies: 8
    Last Post: 06-13-2006, 01:24 AM
  2. Dos prompt cursor position
    By bally1020 in forum C Programming
    Replies: 2
    Last Post: 02-17-2005, 05:10 PM
  3. Output in DOS Prompt
    By siumui in forum C Programming
    Replies: 4
    Last Post: 12-06-2002, 11:27 PM
  4. DOS prompt disapearing
    By Zahl in forum Tech Board
    Replies: 6
    Last Post: 11-17-2002, 06:59 PM
  5. Dos Prompt
    By Unregistered in forum C Programming
    Replies: 3
    Last Post: 01-05-2002, 10:14 AM