converts, formats, and writes data to a file
mfprintf(fd,format,a1,...,an);
: :str a character string: a string to be scanned. : :a1,...,an the data to be converted and printed according to the
format parameter.
:
The mfprintf function is a interface for C-coded version of fprintf function.
The mfprintf function writes formatted operands to the file specified by the file desciptor fd. The argument operands are formatted under control of the format operand.
This function may be used to output column vectors of numbers and string vectors without an explicit loop on the elements. In that case this function iterates on the rows. The shortest vector gives the number of time the format has to be iterated.
An homogeneous sequence of identical type parameters can be replaced by a matrix.
fd = `mopen`_(TMPDIR+'/text.txt','wt');
mfprintf(fd,'hello %s %d.\n','world',1);
mfprintf(fd,'hello %s %d.\n','scilab',2);
mfprintf(fd,'This line is built with a column vector (26:28) %d.\n',[26:28].');
mfprintf(fd,'This line is built with a row vector (26:28) %d.\n',[26:28]);
A = `rand`_(3,6);
mfprintf(fd,'This line is built with a matrix %.3f.\n',A);
`mclose`_(fd);
if (`isdef`_('editor') | (`funptr`_('editor')<>0)) then
`editor`_(TMPDIR+'/text.txt')
end
mfprintf(0,'stderr output.\n');
mfprintf(6,'stdout output.\n');