home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 2 / DATAFILE_PDCD2.iso / utilities2 / desklib / Libraries / TextFile / c / ReadToD next >
Encoding:
Text File  |  1992-04-08  |  1.1 KB  |  41 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    TextFile.ReadToD.c
  12.     Author:  Copyright © 1992 Jason Williams
  13.     Version: 1.00 (07 Apr 1992)
  14.     Purpose: Generic textfile-handling routines
  15. */
  16.  
  17.  
  18. #include "Core.h"
  19. #include "TextFile.h"
  20. #include <stdio.h>
  21.  
  22.  
  23. extern void TextFile_ReadToDelimiter(FILE *infile, char delimiter,
  24.                                      char *line, int maxlength)
  25. {
  26.   int index = 0;
  27.   char thischar = 0;
  28.  
  29.   TextFile_SkipBlanks(infile);
  30.  
  31.   while (!feof(infile) && index < maxlength - 1)
  32.   {
  33.     thischar = getc(infile);
  34.     if (thischar == delimiter)
  35.       break;
  36.  
  37.     line[index++] = thischar;
  38.   }
  39.   line[index] = '\0';
  40. }
  41.