Re: how truncate a file in C?
From: Joe Halpin (jhalpin_at_nortelnetworks.com_.nospam)
Date: 06/17/03
- Next message: Sensorflo: "ddd shows (disabled) as the content of a variable"
- Previous message: Måns Rullgård: "Re: display the file contents of a large tar.Z file"
- In reply to: Valentin Nechayev: "Re: how truncate a file in C?"
- Next in thread: Marc Rochkind: "Re: how truncate a file in C?"
- Reply: Marc Rochkind: "Re: how truncate a file in C?"
- Reply: Valentin Nechayev: "Re: how truncate a file in C?"
- Reply: Frank Cusack: "Re: how truncate a file in C?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: 17 Jun 2003 09:16:53 -0500
Valentin Nechayev <netch@segfault.kiev.ua> writes:
> >>> Frank Cusack wrote:
>
> > MR>> True, but truncating a file opened as a FILE would have an unpredictable
> > MR>> effect on further I/O with the FILE.
> >> IMO fflush() before truncating and fseek() after it help from unpredictability.
> FC> fflush() guarantees nothing here.
>
> Citing SUSv3:
>
> ==={{{
> fflush() shall cause any unwritten data for that stream to be written
> to the file,
> ===}}}
>
> FC> You cannot mix stdio and system I/O
> FC> predictably, period.
>
> You didn't show any arguments for this words.
>
> FC> The effects of interchanging the calls are
> FC> system dependent,
>
> Where is it written? Please show.
SUS3 isn't quite as absolute as the above, but it does give some rules
for defined interaction between stdio streams and file descriptors,
see 'Interaction of File Descriptors and Standard I/O Streams" in
http://www.opengroup.org/onlinepubs/007904975/functions/xsh_chap02_05.html#tag_02_05
If these rules aren't followed, the results are unspecified.
Joe
- Next message: Sensorflo: "ddd shows (disabled) as the content of a variable"
- Previous message: Måns Rullgård: "Re: display the file contents of a large tar.Z file"
- In reply to: Valentin Nechayev: "Re: how truncate a file in C?"
- Next in thread: Marc Rochkind: "Re: how truncate a file in C?"
- Reply: Marc Rochkind: "Re: how truncate a file in C?"
- Reply: Valentin Nechayev: "Re: how truncate a file in C?"
- Reply: Frank Cusack: "Re: how truncate a file in C?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|