simpio.h
Functions | |
Reads a line of text from standard input and scans it as an integer. | |
Reads a line of text from standard input and scans it as a long . | |
Reads a line of text from standard input and scans it as a double . | |
Reads a line of text from standard input and returns the line as a string. | |
Reads a line of text from the input file and returns the line as a string. | |
Reads an entire file into a NULL -terminated array of lines. | |
Reads an entire file into a NULL -terminated array of lines. |
int getInteger(void);
Usage:
n = getInteger();
long getLong(void);
long
. If an integer cannot be scanned or if
extraneous characters follow the number, the user is given
a chance to retry.
Usage:
l = getLong();
double getReal(void);
double
. If an number cannot be scanned or if
extraneous characters follow the number, the user is given
a chance to retry.
Usage:
d = getReal();
string getLine(void);
Usage:
s = getLine();
string readLine(FILE *infile);
readLine
function returns NULL
if infile
is
at the end-of-file position.
Usage:
s = readLine(infile);
string *readLinesFromStream(FILE *infile);
NULL
-terminated array of lines.
Opening and closing the file stream is the responsibility of the caller.
Usage:
string *array = readLinesFromStream(infile);
string *readLinesFromFile(string filename);
NULL
-terminated array of lines.
This version opens the file, reads it, and closes it at the end. If the
file name is "-"
, the function reads from stdin
.
Usage:
string *array = readLinesFromFile(filename);