home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / EMXLIB8F.ZIP / EMX / LIB / IO / TRUNCATE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-02  |  335 b   |  17 lines

  1. /* truncate.c (emx+gcc) -- Copyright (c) 1990-1993 by Eberhard Mattes */
  2.  
  3. #include <io.h>
  4. #include <fcntl.h>
  5.  
  6. int truncate (char *name, long length)
  7. {
  8.   int handle, result;
  9.  
  10.   handle = open (name, O_RDWR);
  11.   if (handle < 0)
  12.     return (-1);
  13.   result = ftruncate (handle, length);
  14.   close (handle);
  15.   return (result);
  16. }
  17.