home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 9 / 09.iso / l / l200 / 6.ddi / LIB / DAAPPEND.C < prev    next >
Encoding:
C/C++ Source or Header  |  1986-08-21  |  569 b   |  31 lines

  1. /*    da_append(name,    len) opens a file for appending
  2.  
  3.     Copyright (c) 1983 by James    F. Gimpel
  4.     Copyright (c) 1983,    1984, 1985 by JMI Software Consultants,    Inc.
  5.  */
  6. #include "acom.h"
  7.  
  8. FILE da_append(name, len)
  9.     TEXT *name;
  10.     INT    len;
  11.     {
  12.     INT    n;
  13.     long cpos, lseek();
  14.     char fbuf[10];
  15.  
  16.     if ((n = da_special(name, YES))    < 0)
  17.         n =    da_file(name, len);
  18.     if (n >= 0)
  19.         {
  20.         while (read(n, fbuf, 1))
  21.            if ((fbuf[0]-'\0') == 26)
  22.               {
  23.               cpos = lseek(n, 0L, 1);
  24.               lseek(n, (cpos-1), 0);
  25.               break;
  26.               }
  27.         da_autoclos(n);
  28.         }
  29.     return (n);
  30.     }
  31.