get_real_line - Reads a line from a stream ignoring blanks and comments
Example compile flags (system dependent):
-DLINUX_X86_64 -DLINUX_X86_64_OPTERON -DGNU_COMPILER
-lKJB -lfftw3 -lgsl -lgslcblas -ljpeg -lSVM -lstdc++ -lpthread -lSLATEC -lg2c -lacml -lacml_mv -lblas -lg2c -lncursesw
This routine is similar to fget_line() except that blank lines and
comment lines are ignored. Comment lines are identified by having the
kjb_comment_char in the first column. Normally kjb_comment_char is '#';
however this is normally exposed to the user as option.
The routine also looks for the comment character in the first column,
followed by !eof (e.g., #!eof), which acts like a soft end of file. In this
case the routine returns EOF, but a subsequent call will return the next
line. This is useful for laying out multiple data structures in a file,
separating them by the soft end of file. Then routines for reading the
sub-structures (e.g. read_matrix()) can be used in sequence for reading the
On success get_real_line() returns the number of bytes placed in the
buffer, excluding the NULL. Alternate return values are all negative. In
the case of end of file or soft end of file, EOF returned. If the line was
truncated, then TRUNCATED is returned. Depending on the signal traps and
options in place, INTERRUPTED is an additional possible return value. In
the case of non-blocking reads WOULD_BLOCK is returned unless a complete
line can be returned. ERROR is returned for unexpected problems and an
error message is set.
BUFF_GET_REAL_LINE(FILE fp, char line)
The max_len parameter is set to sizeof(line) with the appropriate cast.
Using sizeof to set the buffer size is recomended where applicable, as
the code will not be broken if the buffer size changes. HOWEVER, neither
this method, nor the macro, is applicable if line is NOT a character
array. If line is declared by "char* line", then the size of line is the
number of bytes in a character pointer (usually 4), which is NOT what is
normally intended. You have been WARNED!
This software is not adequatedly tested. It is recomended that
results are checked independantly where appropriate.