~ubuntu-branches/ubuntu/karmic/scilab/karmic

« back to all changes in this revision

Viewing changes to man/fileio/mfscanf.man

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
.TH mfscanf 1 "May 1999" "Scilab Group" "Scilab Function"
 
2
.so ../sci.an
 
3
.SH NAME
 
4
 mscanf  - interface to the C scanf function 
 
5
 mfscanf - interface to the C fscanf function 
 
6
 msscanf - interface to the C sscanf function 
 
7
.SH CALLING SEQUENCE
 
8
.nf
 
9
[n,v_1,...v_n]=mfscanf(fd,format)
 
10
L=mfscanf(fd,format)
 
11
 
 
12
[n,v_1,...v_n]=mscanf(format)
 
13
L=mscanf(format)
 
14
 
 
15
[n,v_1,...v_m]=msscanf(format,str)
 
16
L=msscanf(format)
 
17
.fi
 
18
.SH PARAMETERS
 
19
.TP 7
 
20
format
 
21
: a Scilab string describing  the
 
22
format to use to write  the  remaining  operands. 
 
23
The format operand follows, as close as possible, 
 
24
the C printf format operand syntax. 
 
25
.TP
 
26
fd
 
27
:The fd parameter returned by the function \fVmopen\fR is used as a
 
28
file descriptor (it's a positive integer). When specifying the fd
 
29
parameter, the value -1 refers to the default file ( i.e the last
 
30
opened file).
 
31
.TP
 
32
str
 
33
: a Scilab string.
 
34
.TP
 
35
n
 
36
: an integer, the number of data read or -1 if EOL has been
 
37
encountered before any datum has been read.
 
38
.TP
 
39
v_i
 
40
: Each function reads characters, interprets them according to
 
41
a  format,  and  stores  the results in its output arguments. 
 
42
If more than $n$ output arguments are provided, the last ones 
 
43
\fVv_n+1,...v_m\fR are set to empty matrices.
 
44
.TP
 
45
L
 
46
: a matrix of strings or numbers if data read are homogeous or an
 
47
mlist of type (cblock) containing a sequence of homogeneous matrices
 
48
.SH DESCRIPTION
 
49
The \fVmfscanf\fR function reads characters from the stream \fVfd\fR.
 
50
.LP
 
51
The \fVmscanf\fR function reads characters from Scilab window. 
 
52
.LP
 
53
The \fVmsscanf\fR function reads characters from the Scilab string \fVstr\fR.
 
54
 
 
55
.SH EXAMPLES
 
56
.nf
 
57
s='1 1.3'
 
58
[n,a,b]=msscanf(s,"%i %e")
 
59
msscanf(s,"%i %e")
 
60
 
 
61
 
 
62
msscanf(" 12\\n",'%c%c%c%c') //scan characters
 
63
 
 
64
msscanf('0xabc','%x') //scan with hexadecimal format
 
65
 
 
66
 
 
67
msscanf('012345abczoo','%[0-9abc]%s')  //[] notation
 
68
 
 
69
//create a file with data
 
70
u=mopen(TMPDIR+'/foo','w');
 
71
t=0.5;mfprintf(u,"%6.3f %6.3f\\n",t,sin(t))
 
72
t=0.6;mfprintf(u,"%6.3f %6.3f\\n",t,sin(t))
 
73
mclose(u);
 
74
//read the file
 
75
u=mopen(TMPDIR+'/foo','r');
 
76
[n,a,b]=mfscanf(u,'%e %e')
 
77
l=mfscanf(u,'%e %e')
 
78
mclose(u);
 
79
.fi
 
80
 
 
81
.SH SEE ALSO
 
82
mclose, meof, mfprintf, fprintfMat, mfscanf, fscanfMat, mget, mgetstr, mopen, mprintf, mput, mputstr, mscanf, mseek, mtell
 
83