halt()

By sunslayer on Feb 22, 2011

prevents the screen from closing after the program is finished
this is small but incredibly useful, especially if your IDE doesn't have have support for this

example:

#include <iostream>
int main()
{
    std::cout << "hello world!";
    halt();
    return 0;
}
#ifndef HALT_H_
#define HALT_H_ 1
#ifndef _GLIBCXX_IOSTREAM
#include <iostream>
#endif
struct halt{~halt(){std::cin.ignore();}};
#endif

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.