File: mget.man

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 (70 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
.TH mget 1 "April 1999" "Scilab Group" "Scilab Function"
.so ../sci.an
.SH NAME
mget - reads  byte or word in a given binary format and convert to double
mgeti - reads  byte or word in a given binary format return an int type
.SH CALLING SEQUENCE
.nf
x=mget([n,type,fd])
x=mgeti([n,type,fd])
.fi
.SH PARAMETERS
.TP 10
n
:a positive scalar: The number of items to be read.
.TP
fd
: scalar. The \fVfd\fR parameter returned by the function
\fVmopen\fR. -1 stands for last opened file. Default value is -1.
.TP 
type
: a string. Give the binary format used to write all the entries of x.
.TP 
x
: a vector of floating point or integer type numbers
.SH DESCRIPTION
The \fVmget\fR function reads data in the input specified by the
stream parameter \fVfd\fR and returns a vector of floating point data.
The \fVmgeti\fR function reads data in the input specified by the
stream parameter \fVfd\fR and returns a vector of integer data.
.LP
 Data is read at the position at which the file pointer is currently
pointing and advances the indicator appropriately.
.LP
The \fVtype\fR parameter is a conversion specifier which may be set to any of the
following flag characters (with default value "l"):
.TP 13
"l","i","s","ul","ui","us","d","f","c","uc"
: for reading respectively a long, an int, a short, an unsigned
long, an unsigned int, an unsigned short, a double, a float, a char and an unsigned
char. The bytes which are read are automatically swapped if necessary (by checking
little-endian status). This default swapping mode can be
suppressed by adding a flag in the \fVmopen\fR function. Format "l", "d" and
"f" are valid only with the \fVmget\fR function.
.TP
"..l" or "..b" 
: It is also possible to read in little-endian or big-endian mode 
by adding a 'l' or 'b' character at the end of a type specification.
For example "db" will read a double in big-endian mode.
.SH EXAMPLE 
.nf 
file1 = 'test1.bin';
file2 = 'test2.bin';
fd1=mopen(file1,'wb');
fd2=mopen(file2,'wb');
mput(1996,'ull',fd1);
mput(1996,'ull',fd2);
mclose(fd1);
mclose(fd2);

fd1=mopen(file1,'rb');
if 1996<>mget(1,'ull',fd1) ;write(%io(2),'Bug');end;
fd2=mopen(file2,'rb');
if 1996<>mget(1,'ull',fd2) ;write(%io(2),'Bug');end;
mclose(fd1);
mclose(fd2);
.fi 
.SH SEE ALSO
mclose, meof, mfprintf, fprintfMat, mfscanf, fscanfMat, mget, mgetstr, mopen, mprintf, mput, mputstr, mscanf, mseek, mtell