DeskLib 2.90a:TextFile.h


Contents


Introduction and Overview

This header defines routines which may be useful when dealing with text files. Where these functions take a FILE variable, the file should have been opened by fopen in text mode, not binary mode.


Functions


TextFile_SkipBlanks

void TextFile_SkipBlanks(FILE *infile);

This reads characters from the given file until the end of the file is reached or until a non-blank character is found. Blank characters are spaces, tabs and newlines.


TextFile_ReadToDelimiter

void TextFile_ReadToDelimiter(FILE *infile, char delimiter, char *line, int maxlength);

This reads characters from the given file until it reaches the end of the file or the given delimeter character is read. The delimiter is typically a newline character to read a line at a time. Leading spaces or tabs are ignored.

It will read no more than 'maxlength'-1 characters from the file, and zero-terminates the buffer automatically. The delimeter itself is not written to the buffer.


Function-like macro


TextFile_Lowercase

#define TextFile_Lowercase(x) (((x)>='A' && (x)<='Z') ? (x)+32 : (x))

Macro: char Textfile_Lowercase(char ch);

This takes a character and returns the lowercase equivalent. There are only lowercase equivalents for alphabetic characters.