www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/08/12/12:00:14

Xref: news2.mv.net comp.os.msdos.djgpp:7118
From: Jens Jedamzik <jedamzik AT eevmic DOT uni-paderborn DOT de>
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



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019