home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / gnu / man / cat2 / truncate.0 < prev    next >
Text File  |  1993-12-07  |  3KB  |  133 lines

  1.  
  2. TRUNCATE(2)                UNIX Programmer's Manual                TRUNCATE(2)
  3.  
  4. NNAAMMEE
  5.      ttrruunnccaattee - truncate a file to a specified length
  6.  
  7. SSYYNNOOPPSSIISS
  8.      ##iinncclluuddee <<uunniissttdd..hh>>
  9.  
  10.      _i_n_t
  11.      ttrruunnccaattee(_c_o_n_s_t _c_h_a_r _*_p_a_t_h, _o_f_f___t _l_e_n_g_t_h)
  12.  
  13.      _i_n_t
  14.      ffttrruunnccaattee(_i_n_t _f_d, _o_f_f___t _l_e_n_g_t_h)
  15.  
  16. DDEESSCCRRIIPPTTIIOONN
  17.      TTrruunnccaattee() causes the file named by _p_a_t_h or referenced by _f_d to be trun­
  18.      cated to at most _l_e_n_g_t_h bytes in size.  If the file previously was larger
  19.      than this size, the extra data is lost.  With ffttrruunnccaattee(), the file must
  20.      be open for writing.
  21.  
  22. RREETTUURRNN VVAALLUUEESS
  23.      A value of 0 is returned if the call succeeds.  If the call fails a ­1 is
  24.      returned, and the global variable _e_r_r_n_o specifies the error.
  25.  
  26. EERRRROORRSS
  27.      TTrruunnccaattee() succeeds unless:
  28.  
  29.      [ENOTDIR]  A component of the path prefix is not a directory.
  30.  
  31.      [EINVAL]   The pathname contains a character with the high­order bit set.
  32.  
  33.      [ENAMETOOLONG]
  34.                 A component of a pathname exceeded 255 characters, or an en­
  35.                 tire path name exceeded 1023 characters.
  36.  
  37.      [ENOENT]   The named file does not exist.
  38.  
  39.      [EACCES]   Search permission is denied for a component of the path pre­
  40.                 fix.
  41.  
  42.      [EACCES]   The named file is not writable by the user.
  43.  
  44.      [ELOOP]    Too many symbolic links were encountered in translating the
  45.                 pathname.
  46.  
  47.      [EISDIR]   The named file is a directory.
  48.  
  49.      [EROFS]    The named file resides on a read­only file system.
  50.  
  51.      [ETXTBSY]  The file is a pure procedure (shared text) file that is being
  52.                 executed.
  53.  
  54.      [EIO]      An I/O error occurred updating the inode.
  55.  
  56.      [EFAULT]   _P_a_t_h points outside the process's allocated address space.
  57.  
  58.      FFttrruunnccaattee() succeeds unless:
  59.  
  60.      [EBADF]    The _f_d is not a valid descriptor.
  61.  
  62.      [EINVAL]   The _f_d references a socket, not a file.
  63.  
  64.      [EINVAL]   The _f_d is not open for writing.
  65.  
  66. SSEEEE AALLSSOO
  67.      open(2)
  68.  
  69. BBUUGGSS
  70.      These calls should be generalized to allow ranges of bytes in a file to
  71.      be discarded.
  72.  
  73. HHIISSTTOORRYY
  74.      The ttrruunnccaattee function call appeared in 4.2BSD.
  75.  
  76. 4.2 Berkeley Distribution       March 10, 1991                               2
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.