Help on quiting the program without illegel operation

This is a discussion on Help on quiting the program without illegel operation within the C++ Programming forums, part of the General Programming Boards category; I am writing a serial port program, how am i going to stop the program when i can't find the ...

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    29

    Exclamation Help on quiting the program without illegel operation

    I am writing a serial port program, how am i going to stop the program when i can't find the serial port and exit the program without illegal operations..... THAnks!

    Sample of the program:

    if(!GetCommState(hComm, &dcbCPort))
    {cout<<"Error getting com state!"<<endl;
    Application->Terminate();
    CloseHandle(hComm);
    Abort;
    ;
    }
    else
    cout<<"Port ready to use!"<<endl;

    Just remebered, is it ok to use the abort method or is there some other ways to stop the program from process the rest of the codes....???
    mind your own mind...

    PsychoMantis,

  2. #2
    Registered User Dual-Catfish's Avatar
    Join Date
    Sep 2001
    Posts
    802
    Post the entire code...
    If you use return; or return 0; it should quit without errors. (Assuming you're in the main() function)

  3. #3
    Registered User
    Join Date
    Jul 2002
    Posts
    29
    Whaoo...
    Thats cool!
    What a simple code, hehe
    Yup i'm cured Thanks Dual-fish ( two mind fish )?? Thats clever, thanks for the help!!!

    mind your own mind...

    PsychoMantis,

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 12-30-2007, 09:08 AM
  2. Replies: 16
    Last Post: 11-23-2007, 12:48 PM
  3. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  4. BOOKKEEPING PROGRAM, need help!
    By yabud in forum C Programming
    Replies: 3
    Last Post: 11-16-2006, 10:17 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21