Date: Sun, 24 Oct 1999 09:51:38 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Mohamed Saad cc: djgpp AT delorie DOT com Subject: Re: exit makes my program crash (I can't!!) In-Reply-To: <19991022075024.4682.rocketmail@web115.yahoomail.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Fri, 22 Oct 1999, Mohamed Saad wrote: > well... thank you for the idea! but, i can't do this! > because any error messages that would have appeared on > the screen (after returning to text mode ,ofcourse,! a > typical example is the error message "Vesa 2 not > supported!"), will disappear before any one can read > them! If those messages are printed while the program is in a graphics mode that is not one of the standard VGA modes, you won't see the message anyway. If you want to be sure that you don't miss any fatal error messages, you should redirect stderr (and perhaps stdout as well) to a file. (Use the dup2 library function for this purpose.) Then you could examine that file for possible messages. You could also catch the output to stderr by installing a File System Extension handler (see "info libc alpha 'file system'" for more details about this feature), and arrange for your atexit handler to print all of the caught messages after switching to the text mode. But this is more complicated to implement, and perhaps overkill in your case. > btw, how can i write a DOS program the does not use > the CPU heavily?? isn't the program taking the whole > time of the cpu?? isn't it always executing > instructions? When a program is in an idle loop, e.g., waiting for keyboard input, it can release the rest of its time slice by calling library function __dpmi_yield. This does nothing on DOS, since there's only one active program at any given time, but on Windows a program that does this is much nicer to the other programs.