terminate a c++ program before the end has come?

Sharky Forums


Results 1 to 3 of 3

Thread: terminate a c++ program before the end has come?

  1. #1
    Hammerhead Shark Notin's Avatar
    Join Date
    Jan 2001
    Posts
    1,005

    Post terminate a c++ program before the end has come?

    Okay, I'm still a newbie to c++. I'm doing my first program, and everything is almost done. Except I was wondering how I could get it to end the program once someone enters in a certain variable. There must be a simple way to do this... isn't there?

    please help me?

    Thanks in advance

    ------------------
    SBC's FF Member

    Take a walk to Combustion Junction
    Can't sleep, clowns will eat me...
    Can't sleep, clowns will eat me...
    Can't sleep, clowns will eat me...

  2. #2
    Tiger Shark
    Join Date
    Feb 2001
    Location
    Dublin
    Posts
    559

    Post

    void exit(int status);

    Status is usually 0.

    So to exit your program on some condition

    if (condition) {
    exit(0);
    }

    ------------------
    port22
    1Ghz TBird @ 1.05 Ghz/Asus A7v
    256 Mb PC133/Asus Geforce 2 GTS 64Mb: FreeBSD 4.2 & Windows ME

    Alpha 600Mhz EV56/128Mb ECC
    4mb Mystique/4Gb UW SCSI: Debian GNU/Linux

  3. #3
    Hammerhead Shark Notin's Avatar
    Join Date
    Jan 2001
    Posts
    1,005

    Post

    That did the trick

    thank you!!!

    ------------------
    SBC's FF Member

    Take a walk to Combustion Junction
    Can't sleep, clowns will eat me...
    Can't sleep, clowns will eat me...
    Can't sleep, clowns will eat me...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •