The "chs" Package

These routines are meant to provide a simple method of reading (scanning) channel objects for ASCII representations of floating point and integer values.

Library: karma
Link With: -lkarma

Functions

chs_get_valueScan a channel object for a whitespace separated value.
chs_get_value2Scan a channel object for a whitespace separated value.
chs_get_floatScan a channel object for a float value.
chs_get_intScan a channel object for an integer value.
chs_get_lineScan a channel object for a line.
chs_get_line2Scan a channel object for a line.


Functions


unsigned int chs_get_value (Channel channel, char *string, unsigned int length)

Scan a channel object for a whitespace separated value.

Parameters:

Returns: The length of the string scanned on success, else 0.
Multithreading Level: Unsafe


EXPERIMENTAL FUNCTION: subject to change without notice

unsigned int chs_get_value2 (Channel channel, char *string, unsigned int length, flag *newline)

This routine will scan a channel object for a whitespace separated value. '#' is the comment character.

Parameters:

Returns: The length of the string scanned on success, else 0.
Multithreading Level: Unsafe


double chs_get_float (Channel channel)

This routine will scan a channel object for the ASCII representation of a floating point number. Any leading whitespace will be ignored.

Parameters:

Returns: The value scanned. On error the process exits.
Multithreading Level: Unsafe


int chs_get_int (Channel channel)

This routine will scan a channel object for the ASCII representation of an integer number. Any leading whitespace will be ignored.

Parameters:

Returns: The value scanned. On error the process exits.
Multithreading Level: Unsafe


flag chs_get_line (Channel channel, char *buffer, unsigned int length)

This routine will read a line from a channel, stripping all comments, leading and trailing whitespace. The comment character is '#'. The comment character is ignored if between quotes. Blank or commented lines are ignored.

Parameters:

Returns: TRUE on success, else FALSE (indicating End-Of-File). Data is still written to the buffer and NULL terminated on EOF.
Multithreading Level: Unsafe


EXPERIMENTAL FUNCTION: subject to change without notice

flag chs_get_line2 (Channel channel, char *buffer, unsigned int length, char comment)

This routine will read a line from a channel, stripping all comments, leading and trailing whitespace. The comment character is ignored if between quotes. Blank or commented lines are ignored.

Parameters:

Returns: TRUE on success, else FALSE (indicating End-Of-File). Data is still written to the buffer and NULL terminated on EOF.
Multithreading Level: Unsafe


Back to Karma Home Page
Contact: Richard Gooch
Web Development: Ariel Internet Services