mfscanf
reads input from the stream pointer stream (interface to the C
fscanf function)
mscanf
reads input from the standard input (interface to the C scanf
function)
msscanfreads its input from the character string (interface to the C
sscanf function)
Calling Sequence
[n, v_1,..., v_m] = mfscanf([niter,]fd, format)
L = mfscanf([niter,] fd,format)
[n, v_1,..., v_m] = mscanf([niter,] format)
L = mscanf([niter,]format)
[n, v_1,..., v_m] = msscanf([niter,]str, format)
L = msscanf([niter,] str, format)
Argumentsformat
a Scilab string describing the format to use to write the
remaining operands. The format operand
follows, as close as possible, the C printf
format operand syntax as described in
scanf_conversion.
fd
a positive integer: a file descriptor returned by the function
mopen. The value -1 refers to the last
opened file.
stra Scilab string or string vector.niter
an integer: the number of times the
format
to be used.
nan integer: the number of data read or -1 if EOL has been
encountered before any datum has been read.
v_i
Each function reads characters, interprets them according to a
format, and stores the results in its output
arguments. If more than n output arguments are
provided, the last ones v_n+1, ..., v_m are
set to empty matrices.
L
if all data are homogeneous they are stored in a unique vector
which is returned, otherwise subsequences of same data type are
stored in matrices and a mlist (with type
cblock) containing all the built matrices is
returned.
Description
The mfscanf function reads characters from the
stream fd.
The mscanf function reads characters from Scilab
window.
The msscanf function reads characters from the
Scilab string str.
The niter optional argument specifies how many
time the format has to used. One iteration produces one line in the output
matrix. If niter==-1 the function iterates up to the
end of file. The niter default value is 1.
Comments about precision:mfscanf is based on C function
fscanf. If you use '%f',
'%g', '%e' as format your data
will be cast to float and returned in a Scilab variable.
If this Scilab variable is a double then you can have some precision
errors. In this case, it is better to use '%lg' format.
ExamplesSee Also
mclose
meof
mfprintf
fprintfMat
fscanfMat
mget
mgetstr
mopen
mprintf
mput
mputstr
mseek
mtell
mdelete
scanf_conversion