File: 240.htm

package info (click to toggle)
eagle 4.16-5
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 36,508 kB
  • sloc: sh: 82; makefile: 32
file content (65 lines) | stat: -rw-r--r-- 1,775 bytes parent folder | download | duplicates (2)
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
<html>
<head>
<title>EAGLE Help: fileread()</title>
</head>
<body bgcolor=white>
<font face=Helvetica,Arial>
<hr>
<i>EAGLE Help</i>
<h1><center>fileread()</center></h1>
<hr>
<dl>
<dt>
<b>Function</b>
<dd>
Reads data from a file.
<p>
<dt>
<b>Syntax</b>
<dd>
<tt>int fileread(<i>dest</i>, string file);</tt>
<p>
<dt>
<b>Returns</b>
<dd>
<tt>fileread</tt> returns the number of objects read from the file.<br>
The actual meaning of the return value depends on the type of <tt>dest</tt>.
<p>
</dl>
<b>See also</b> <a href=249.htm>lookup</a>,
<a href=264.htm>strsplit</a>,
<a href=235.htm>fileerror</a>
<p>
If <tt>dest</tt> is a character array, the file will be read as raw binary data
and the return value reflects the number of bytes read into the character array
(which is equal to the file size).
<p>
If <tt>dest</tt> is a string array, the file will be read as a text file (one line
per array member) and the return value will be the number of lines read into the
string array. Newline characters will be stripped.
<p>
If <tt>dest</tt> is a string, the entire file will be read into that string
and the return value will be the length of that string (which is not necessarily
equal to the file size, if the operating system stores text files with "cr/lf"
instead of a "newline" character).
<p>
<b>Example</b>
<pre>
char b[];
int nBytes = fileread(b, "data.bin");
string lines[];
int nLines = fileread(lines, "data.txt");
string text;
int nChars = fileread(text, "data.txt");
</pre>

<hr>
<table width=100% cellspacing=0 border=0><tr><td align=left><font face=Helvetica,Arial>
<a href=index.htm>Index</a>
</font></td><td align=right><font face=Helvetica,Arial size=-1>
<i>Copyright &copy; 2005 CadSoft Computer GmbH</i>
</font></td></tr></table>
<hr>
</font>
</body>
</html>