Re: How to Truncate a file opened by fopen()
- From: Harring Figueiredo <harringf yahoo com>
- To: Harsha Kodnad <harsha km tallysolutions com>,	GTK <gtk-app-devel-list gnome org>, GNOME <gnome-devel-list gnome org>
- Cc: 
- Subject: Re: How to Truncate a file opened by fopen()
- Date: Thu, 16 Sep 2004 06:50:52 -0700 (PDT)
--- Harsha Kodnad <harsha km tallysolutions com> wrote:
> Hi All,
> 
>     How can I truncate  a file opened by fopen() ?
> 
>     If I want to extend my file or truncate my file I have to use ftruncate,
> but ftruncate takes int (file descriptor) is there any function which takes
> FILE * ?
> 
 Note that fopen has a mode parameter , one of which is: (from man fopen)
 "w"     Truncate  file  to  zero length or create text file for writing. The
stream is positioned at the beginning of the file.
  In case you still need to get the file descriptor from a FILE* , you can use
 int fileno(FILE *stream);
  man fileno for more details.
 Regards, 
 Harring
 
  
__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]