home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / d / desklib / !DeskLib / h_doc / TextFile < prev    next >
Encoding:
Text File  |  1996-05-21  |  2.1 KB  |  68 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.     History: 1.00 (07 Apr 1992) JW
  16.              1.01 (15 Oct 1995) JS Added #include of Core.h
  17. */
  18.  
  19.  
  20. #ifndef __Desk_TextFile_h
  21. #define __Desk_TextFile_h
  22.  
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26.  
  27. #include <stdio.h>
  28.  
  29. #ifndef __Desk_Core_h
  30.     #include "Desk.Core.h"
  31. #endif
  32.  
  33.  
  34. #define Desk_TextFile_Lowercase(x) (((x)>='A' && (x)<='Z') ? (x)+32 : (x))
  35.  
  36.  
  37. extern void Desk_TextFile_SkipBlanks(FILE *infile);
  38. /*  reads characters from the given file until eof or until a non-blank
  39.  *  (space or tab character) is found.
  40.  */
  41.  
  42.  
  43. extern void Desk_TextFile_GetToken(FILE *infile, char delimiter,
  44.                               char *token,  Desk_bool lowercase);
  45. /*  Read in a token from a file. A token is defined as:
  46.  *    A sequence of up to 32 characters, delimited by a specific character
  47.  *    or a newline. Leading spaces/tabs are ignored.
  48.  *
  49.  *  This is generally used to read a word from a textfile (delimiter = ' ')
  50.  *  or to read tags from a msgtrans style file (delimiter = ":")
  51.  */
  52.  
  53.  
  54. extern void Desk_TextFile_ReadToDelimiter(FILE *infile, char delimiter,
  55.                                      char *line, int maxlength);
  56. /*  Reads characters from the given file until eof or delimiter character
  57.  *  Delimiter is typically a newline character, which gives read-to-eol
  58.  *  Leading spaces/tabs are ignored
  59.  *  Won't read more than "maxlength" characters (maxlength *includes* 0
  60.  *  string-terminating character)
  61.  */
  62.  
  63. #ifdef __cplusplus
  64. }
  65. #endif
  66.  
  67. #endif
  68.