File: mfscanf.cat

package info (click to toggle)
scilab 2.6-4
  • links: PTS
  • area: non-free
  • in suites: woody
  • size: 54,632 kB
  • ctags: 40,267
  • sloc: ansic: 267,851; fortran: 166,549; sh: 10,005; makefile: 4,119; tcl: 1,070; cpp: 233; csh: 143; asm: 135; perl: 130; java: 39
file content (74 lines) | stat: -rw-r--r-- 2,363 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
mfscanf           Scilab Group           Scilab Function            mfscanf
NAME
    mscanf  - interface to the C scanf function   mfscanf - interface to the
  C fscanf function   msscanf - interface to the C sscanf function 
  
CALLING SEQUENCE
 [n,v_1,...v_n]=mfscanf(fd,format)
 L=mfscanf(fd,format)
 
 [n,v_1,...v_n]=mscanf(format)
 L=mscanf(format)
 
 [n,v_1,...v_m]=msscanf(format,str)
 L=msscanf(format)
PARAMETERS
 format  : 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. 
         
 fd      :The fd parameter returned by the function mopen is used as a
         file descriptor (it's a positive integer). When specifying the fd
         parameter, the value -1 refers to the default file ( i.e the last
         opened file).
         
 str     : a Scilab string.
         
 n       : an 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       : a matrix of strings or numbers if data read are homogeous or an
         mlist of type (cblock) containing a sequence of homogeneous
         matrices
         
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. 
  
EXAMPLES
 s='1 1.3'
 [n,a,b]=msscanf(s,"%i %e")
 msscanf(s,"%i %e")
 
 
 msscanf(" 12\n",'%c%c%c%c') //scan characters
 
 msscanf('0xabc','%x') //scan with hexadecimal format
 
 
 msscanf('012345abczoo','%[0-9abc]%s')  //[] notation
 
 //create a file with data
 u=mopen(TMPDIR+'/foo','w');
 t=0.5;mfprintf(u,"%6.3f %6.3f\n",t,sin(t))
 t=0.6;mfprintf(u,"%6.3f %6.3f\n",t,sin(t))
 mclose(u);
 //read the file
 u=mopen(TMPDIR+'/foo','r');
 [n,a,b]=mfscanf(u,'%e %e')
 l=mfscanf(u,'%e %e')
 mclose(u);
   
  
SEE ALSO
   mclose, meof, mfprintf, fprintfMat, mfscanf, fscanfMat, mget, mgetstr,
  mopen, mprintf, mput, mputstr, mscanf, mseek, mtell