string_get_real_line - Reads a line from a string ignoring blanks and comments


#include "l/l_io.h"

Example compile flags (system dependent):
   -L/home/kobus/misc/load/linux_x86_64_opteron -L/usr/lib/x86_64-linux-gnu
  -lKJB                               -lfftw3  -lgsl -lgslcblas -ljpeg  -lSVM -lstdc++                    -lpthread -lSLATEC -lg2c    -lacml -lacml_mv -lblas -lg2c      -lncursesw 

long string_get_real_line
	const char **buff_ptr,
	char *line,
	size_t max_len


This routine is analogous to get_real_line() except that the "stream" is string in memory that is cut up into lines on successive calls until a null terminator is reached. Unlike get_real_line(), there no concept of soft EOF. More specifically, the line is extracted from the string starting at the postion *buff_ptr which is set to the updated location beyond what has been parsed.


If there are no more characters to be read, then EOF is returned. If the buffer is not large enough, SET_BUFFER_OVERFLOW_BUG() is called, and TRUNCATED is returned. Otherwise NO_ERROR is returned.


BUFF_STRING_GET_REAL_LINE(const char**, 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.


Kobus Barnard


Kobus Barnard


set_program_prompt , kjb_query , print_blanks , rep_print , count_real_lines , count_data_lines_until_next_header , count_tokens_in_file , get_real_line , string_count_real_lines , get_command_text , add_line_to_input_stream , read_int_from_file , read_dbl_from_file , push_no_overwrite , pop_no_overwrite , set_no_overwrite , get_no_overwrite