Declare reading text file related functions. More...
#include <stdio.h>
Go to the source code of this file.
Functions | |
int | mbs_getlinesize (FILE *stream) |
Compute the line length. More... | |
int | get_file_nb_lines_col (FILE *fp, int *n_line, int *max_width) |
Return the number of line and the max line width in remainder of the file. More... | |
Declare reading text file related functions.
authors: Robotran team.
int get_file_nb_lines_col | ( | FILE * | fp, |
int * | n_line, | ||
int * | max_width | ||
) |
Return the number of line and the max line width in remainder of the file.
Only the remainder of the stream (ie. located after current stream position) is parsed. The position of the cursor is restored at the end of the function even if the evaluation fails.
Note:
[in,out] | fp | The pointer to the file stream open in text mode. The stream position is restored except if the fseek() function fails. |
[out] | n_line | Memory pointer to the number of line. |
[out] | max_width | Memory pointer to the maximum line width, excluding the null byte used to end output to strings) |
int mbs_getlinesize | ( | FILE * | stream | ) |
Compute the line length.
The length does not include the end-of-line ('
') nor end-of-char ('\0') character.
[in,out] | stream | Stream to be parsed. |
Returns -1 on failure to read a line (including end-of-file condition). In the event of an error, errno is set to indicate the cause. EINVAL Bad arguments (n or lineptr is NULL, or stream is not valid).