#include <mplib1/fgetline.h> int fgetline( FILE *fh, char *line_buf, int line_len );This function provides a simple way of reading a line from a file into a buffer. Up to line_len-1 characters will be read. The routine strips any trailing newline characters from the buffer.
The function returns 0 on success and -1 on failure.
A typical use would be look like.
char tbuf[T_BUF_LEN]; FILE *fh; .... while(fgetline(fh,tbuf,T_BUF_LEN)==0) process_line( tbuf );
#include <mplib1/fgetline.h> int fgetline2( FILE *fh, char *line_buf, int line_len );This function provides a simple way of reading a line from a file into a buffer. Up to line_len-1 characters will be read. The routine strips any trailing newline characters from the buffer. It also skips any lines which have '#' as their first non-blank character.
The function returns 0 on success and -1 on failure.
A typical use would be look like.
char tbuf[T_BUF_LEN]; FILE *fh; .... while(fgetline2(fh,tbuf,T_BUF_LEN)==0) process_line( tbuf );