char *FLgetRec (FILE *fp, const char CommChar[], const char ContChar[], int echo)


Read and assemble a text record from an input stream


This routine reads lines of text from an input stream. Comments are removed and multiple lines with continuation marks are assembled into a single text record. Empty lines (all white space) are considered to be comment lines.

The operations in assembling a text record are as follows.

1: Read a line of text
2: Remove any characters from the comment marker to the end of the line
3: Look for a continuation marker as the last character on the line. For lines with continuation markers: remove the continuation marker and concatenate the next line onto the end of the current line.

This routine has provision for echoing the input lines, with or without comments. No echoing is done is the input is from a terminal.


<- char *FLgetRec
Pointer to the text string. This is NULL if end-of-file is encountered and the line is empty. Otherwise, when end-of-file is encountered, the line is treated as if it were terminated with a newline. The text string is in an internally allocated storage area; each call to this routine overlays this storage.
-> FILE *fp
File pointer for the input stream
-> const char CommChar[]
String containing characters that mark the beginning of a comment. This string may be empty.
-> const char ContChar[]
String containing characters that mark a continuation line. This string may be empty.
-> int echo
Echo control flag. 0 - No echo, 1 - Echo with comments stripped off, 2, echo with comments intact

Author / revision

P. Kabal / Revision 1.18 2003/05/09

See Also


Main Index libtsp