[CLUG] files

Collins_Paul at emc.com Collins_Paul at emc.com
Mon Feb 7 08:58:48 GMT 2000


Try changing your original program to call fflush on the stream that you are
writing to after every number is written.  This will make sure the
information is flushed to Linux's buffers from the C library's buffers.  You
can check the file as it is written.  There is a call you can use to stop
buffering entirely, called fsetvbuf (I think; it's something like that,
anyway).

The numbers probably were in the file until the machine was restarted.  The
fsck may have not been able to recover the file.  On an off-chance, have a
look in the lost+found directory for the filesystem the file was in.  (That
is where files similar to scandisk .CHK files go.)

Paul.

> -----Original Message-----
> From: Bobby Heffernan [mailto:bobheff at esatclear.ie]
> Sent: 04 February 2000 23:12
> To: Cork LUG
> Subject: [CLUG] files
> 
> 
> how and when does linux write it's files to the disk?
> I wrote s imple C program that's doing some caluclations for 
> me - every
> time it gets a result it writes the number to a file
> when it's running and you access the file there's nothing there (even
> though I know it has gotten some results)
> the power went and when I restarted the machine the file was empty - I
> had lost about two and a half days of number crunching
> yet - if I set the program to iterate only a few times so that it gets
> one or two results when it finishes (in a few seconds - doing 
> about 500
> loops) I look at the file and its got three entries (which is right)
> does linux write the file to the disk only after the program has
> completed?
> or what??
> 
> --
> 
> _______________________
> Windows NT crashed.
> I am the Blue Screen of Death.
> No one hears your screams.
> ----------------------------------------
> 
> 
> 
> _______________________________________________
> Cork maillist  -  Cork at linux.ie
> http://www.linux.ie/mailman/listinfo/cork
> 




More information about the Cork mailing list