Xref: news2.mv.net comp.os.msdos.djgpp:7118 From: Jens Jedamzik Newsgroups: comp.os.msdos.djgpp Subject: Re: interrupting with ctrl-C Date: 12 Aug 1996 14:50:19 GMT Organization: Universitaet Paderborn, Germany Lines: 28 Message-ID: <4ungbb$bqa@news.uni-paderborn.de> NNTP-Posting-Host: eevpc1.uni-paderborn.de To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp jacobsen AT kjemi DOT unit DOT no (Elling Jacobsen) schreibt: > Hello, > I have a program in which I write data records to a > number of files. My problem is that when I interrupt > the program using ctrl-C, the files are left empty. I guess > the reason is that the data are kept in memory and are > not dumped to file at interrupt? Is there any way to > ensure that all data records are written to file at > interrupt? No matter, how many data you write in a file, MS-DOS recognizese it's actual size only after closing it via a system call. The simplest way to help your problem could be, to close the files after each write access and re-open it in append mode before the next write access. (That's the way I used for my data logger.) Another possible solution is/might be (?) to reditrect the interrupt to an exit routine that closes all your files. I hope, that will help you... Jens