emulating BSD "ftruncate" on SYSV

Rick Pelleg rick at taux01.UUCP
Thu Mar 16 17:32:36 AEST 1989


Hello ye wizards.  Can anyone help me with the following problem?

Is it possible to emulate the BSDs system-call

     ftruncate(fd, length)
     int fd;
     off_t length;

on UNIX SYS-V, Using anything available (library + system calls)?

No, I DON'T have the name of the file... only a file pointer
which I can convert to a file-descriptor using 'fileno()'.

And please do not answer 'fp = fdopen(fileno(fp), "w")', as this will
return a NEW file pointer (i.e., a new _iob entry).  The old file
pointer info will remain and be flushed when files are closed (e.g.,
by exit()).

I am not a regular reader of this group, so please mail answers directly
to me.  I will summarize the interesting ones for the net.

Thanks in advance
-- 
--- Rick Pelleg
National Semiconductor (Israel)
6 Maskit st. P.O.B. 3007, Herzlia 46104, Israel  Tel. (972)52-522264
rick%taux01 at nsc.com @{hplabs,pyramid,sun,decwrl}



More information about the Comp.unix.questions mailing list