Closing the console

Posted on 2004-11-27
Last Modified: 2010-04-01
I have a console program. I would like an option to close it.
I want to do this from outside the main function. So, a simple
return will not due. How can I end it on command?
Question by:List244
    LVL 19

    Accepted Solution

    I think you could just call exit(-1);
    LVL 8

    Author Comment

    exit what header would that be a part of?
    LVL 19

    Expert Comment

    #include <windows.h>

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
    Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
    The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
    The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now