home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / desklib / !DeskLib / h / TextFile < prev    next >
Encoding:
Text File  |  1992-04-09  |  1.9 KB  |  53 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. #define TextFile_Lowercase(x) (((x)>='A' && (x)<='Z') ? (x)+32 : (x))
  24.  
  25.  
  26. extern void TextFile_SkipBlanks(FILE *infile);
  27. /*  reads characters from the given file until eof or until a non-blank
  28.  *  (space or tab character) is found.
  29.  */
  30.  
  31.  
  32. extern void TextFile_GetToken(FILE *infile, char delimiter,
  33.                               char *token,  BOOL lowercase);
  34. /*  Read in a token from a file. A token is defined as:
  35.  *    A sequence of up to 32 characters, delimited by a specific character
  36.  *    or a newline. Leading spaces/tabs are ignored.
  37.  *
  38.  *  This is generally used to read a word from a textfile (delimiter = ' ')
  39.  *  or to read tags from a msgtrans style file (delimiter = ":")
  40.  */
  41.  
  42.  
  43. extern void TextFile_ReadToDelimiter(FILE *infile, char delimiter,
  44.                                      char *line, int maxlength);
  45. /*  Reads characters from the given file until eof or delimiter character
  46.  *  Delimiter is typically a newline character, which gives read-to-eol
  47.  *  Leading spaces/tabs are ignored
  48.  *  Won't read more than "maxlength" characters (maxlength *includes* 0
  49.  *  string-terminating character)
  50.  */
  51.  
  52. #endif
  53.