Date: Sun, 17 Oct 1999 14:12:49 +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!!!! (The solution) In-Reply-To: <19991014153345.382.rocketmail@web122.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 Thu, 14 Oct 1999, Mohamed Saad wrote: > i had a look > on the source code of exit() and i found it sets the > mode back to text mode before calling _exit()! You didn't look deep enough under the hood. The exit code calls the `setmode' function to set the console device to the text (as opposed to binary) mode, but that has nothing to do with switching the VGA to the text mode. The text/binary mode of the console has to do with translation of CR-LF pairs into a single Newline character during DOS I/O, it has nothing to do with the VGA mode. > P.S. I have discovered that i do not free() some > malloc'ed() memory! may this be the reason? No. All memory is released automatically when the program exits. > P.P.S. before i forget, can i combine new, delete, and > realloc?? This is a very bad idea. In C++ programs you should use new and delete, not malloc and its friends.