JWS C Library
C language utility library
file_io.c File Reference

Definitions for file I/O utility functions. More...

#include <jwsc/config.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <assert.h>
#include <inttypes.h>
#include "jwsc/base/file_io.h"
Include dependency graph for file_io.c:

Go to the source code of this file.

Functions

int skip_fp_spaces_and_comments (FILE *fp)
 Skips the fp ahead over blank space and lines beginning with '#'.
int skip_line (FILE *fp)
 Skips a line of input.
int count_fp_line_columns (FILE *fp)
 Counts the number of space separated columns in a line.

Detailed Description

Definitions for file I/O utility functions.

Author:
Joseph Schlecht
License:
Creative Commons BY-NC-SA 3.0

Definition in file file_io.c.


Function Documentation

int skip_fp_spaces_and_comments ( FILE *  fp)

Skips the fp ahead over blank space and lines beginning with '#'.

Parameters:
fpFile to skip comments and blank lines in.
Returns:
0 if fp is positioned at the EOF after skipping over all comments; 1 otherwise.

Definition at line 65 of file file_io.c.

int skip_line ( FILE *  fp)

Skips a line of input.

Skips the file pointer ahead, one position past the newline character '\n'.

Parameters:
fpFile to skip a line of input from.
Returns:
0 if fp is positioned at the EOF after skipping a line; 1 otherwise.

Definition at line 100 of file file_io.c.

int count_fp_line_columns ( FILE *  fp)

Counts the number of space separated columns in a line.

The file pointer is advanced to either just after the newline character or EOF.

Parameters:
fpFile to count the columns in.
Returns:
Number of columns on the line.

Definition at line 118 of file file_io.c.