|
fscanf
|
Batch language command
|
|
Input command. Used to read values of numbers, matrices or trees from files or the console.
|
Syntax
|
fscanf(filename or stdin, format string, list of variables expressions or string literals);
|
Notes
|
The first parameter is either a filename, given as a quote-enclosed relative path to the file containing 'fprintf' or stdin (console) w/o the quotes. It could also be PROMPT_FOR_FILE if the user is to be prompted for the input file. Format string is a quote-enclosed comma separated list with 4 allowed terms: - Number : read a number; - Matrix : read a matrix; - Tree : read a tree String: read a string. Fscanf will skip all the characters in between meaningful input.
Matrices are enclosed in '{..}'. Trees are enclosed in '(..)'. 'filename' can be a string variable.
Sets END_OF_FILE.
|
Examples
|
// given string: 0.12; {{0,1}{1,0}} sjdiwj ((1,2),3,4)fscanf (stdin, "Number,Matrix,Tree",x,m,t); //will read number .12 into x matrix {{0,1}{1,0}} into m and tree ((1,2),3,4) into t
|
|
Last modified: 8/20/2002 |
|
|