home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / gcc / !GCC / patches / DeskLib / h / TextFile < prev    next >
Encoding:
Text File  |  1994-10-03  |  1.9 KB  |  61 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.h
  12.     Author:  Copyright © 1992 Jason Williams
  13.     Version: 1.00 (07 Apr 1992)
  14.     Purpose: Generic textfile-handling routines
  15. */
  16.  
  17.  
  18. #ifndef __dl_textfile_h
  19. #define __dl_textfile_h
  20.  
  21. #include <stdio.h>
  22.  
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26.  
  27. #define TextFile_Lowercase(x) (((x)>='A' && (x)<='Z') ? (x)+32 : (x))
  28.  
  29.  
  30. extern void TextFile_SkipBlanks(FILE *infile);
  31. /*  reads characters from the given file until eof or until a non-blank
  32.  *  (space or tab character) is found.
  33.  */
  34.  
  35.  
  36. extern void TextFile_GetToken(FILE *infile, char delimiter,
  37.                               char *token,  BOOL lowercase);
  38. /*  Read in a token from a file. A token is defined as:
  39.  *    A sequence of up to 32 characters, delimited by a specific character
  40.  *    or a newline. Leading spaces/tabs are ignored.
  41.  *
  42.  *  This is generally used to read a word from a textfile (delimiter = ' ')
  43.  *  or to read tags from a msgtrans style file (delimiter = ":")
  44.  */
  45.  
  46.  
  47. extern void TextFile_ReadToDelimiter(FILE *infile, char delimiter,
  48.                                      char *line, int maxlength);
  49. /*  Reads characters from the given file until eof or delimiter character
  50.  *  Delimiter is typically a newline character, which gives read-to-eol
  51.  *  Leading spaces/tabs are ignored
  52.  *  Won't read more than "maxlength" characters (maxlength *includes* 0
  53.  *  string-terminating character)
  54.  */
  55.  
  56. #ifdef __cplusplus
  57.            }
  58. #endif
  59.  
  60. #endif
  61.