next up previous
Next: free_description() Up: Brain Volume I/O Handling Previous: read_lhs_rhs()

scan_these()  

Array scanning of string



Synopsis


int 
scan_these(char *line, int n, char *format,  void *dest, int size)


Description
The string in line is scanned using formatstring spec. in format and the result is stored in the dest array. size specifies the size of the individual elements in bytes. n specifies the maximum number of elements to scan. Each element in the *line string are separated by an isspace() character.

The return value is the actual number of parameters successfully scanned.

Usage

Ex.
scan\_these(" 12.3 4332.2 12.43", 3, "%f", myarray, sizeof(*myarray));

returns 3 and fills the float array myarray with the values [12.3, 4332.2, 12.43]

Revision


1.0  29/10-96   Ulrik Kjems


Program listing






Ulrik Kjems
6/3/1998