home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / compat / unistd / ftruncat.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-28  |  281 b   |  15 lines

  1. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  2. #include <libc/stubs.h>
  3. #include <unistd.h>
  4. #include <io.h>
  5.  
  6. int
  7. ftruncate(int fd, off_t where)
  8. {
  9.   if (lseek(fd, where, 0) == -1)
  10.     return -1;
  11.   if (_write(fd, 0, 0) < 0)
  12.     return -1;
  13.   return 0;
  14. }
  15.