TSP (libtsp/FL) - FLgetRec

## FLgetRec

#### Routine

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

#### Purpose

Read and assemble a text record from an input stream

#### Description

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.

#### Parameters

<- 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
-> char cc[]
  Control characters. This string is the concatenation of two null terminated substrings. The first substring contains characters that mark the beginning of a comment. The second substring contains characters that can be used to mark a continuation line. Either substring can be empty. For instance if the comment character is the exclamation mark and the continuation character is the back slash character, the cc parameter would be specified as "!\0\\".
-> int echo
  Echo control flag. 0 - No echo, 1 - Echo with comments stripped off, 2, echo with comments intact

#### Author / revision

P. Kabal Copyright (C) 1997 / Revision 1.14 1997/10/14

#### See Also

FLgetLine

Main Index libtsp