|
-
February 21st, 2011, 03:08 AM
#5
Re: Restarting the program
If you want to break out and restart your program from anywhere, then a try-catch construct might be better addapted than a plain while loop.
In any case, make sure your constructs are RAII (or make sure you correctly clean-up) to avoid memory leaks.
The usual alternative is to just exit the program, and have it restart from an external source. That's what 99% of command line apps do.
Is your question related to IO?
Read this C++ FAQ article at parashift by Marshall Cline. In particular points 1-6.
It will explain how to correctly deal with IO, how to validate input, and why you shouldn't count on "while(!in.eof())". And it always makes for excellent reading.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|