1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
2 |
"http://www.w3.org/TR/html4/strict.dtd"> |
"http://www.w3.org/TR/html4/strict.dtd"> |
3 |
<HTML> |
<html> |
4 |
<HEAD> |
<head> |
5 |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
6 |
<TITLE>filereadln</TITLE> |
<title>filereadln</title> |
7 |
<META http-equiv="Content-Style-Type" content="text/css"> |
<meta http-equiv="Content-Style-Type" content="text/css"> |
8 |
<link rel="stylesheet" href="../../style.css" type="text/css"> |
<link rel="stylesheet" href="../../style.css" type="text/css"> |
9 |
</HEAD> |
</head> |
10 |
<BODY> |
|
11 |
|
<body> |
12 |
<DIV ALIGN="left"> |
|
13 |
<FONT SIZE="+2">filereadln</FONT><BR><BR> |
|
14 |
</div> |
<h1>filereadln</h1> |
15 |
|
|
16 |
Format: |
<p> |
17 |
<UL> |
Reads a line from file. |
18 |
<B> |
</p> |
19 |
|
|
20 |
|
<pre class="macro-syntax"> |
21 |
filereadln <file handle> <strvar> |
filereadln <file handle> <strvar> |
|
</B> |
|
|
</UL> |
|
|
<P></P> |
|
|
|
|
|
Reads a line from the file specified by <file handle>. |
|
|
The line is written into the string variable <strvar>. The file pointer is moved to the beginning of the next line. If the file pointer reaches the end of the file while reading the line, the system variable "result" is set to 1. Otherwise, "result" is set to zero. |
|
|
<P></P> |
|
|
|
|
|
<pre> |
|
|
Example: |
|
|
fileopen fhandle 'test.txt' 0 Open a file. |
|
|
:loop |
|
|
filereadln fhandle line Read a line from the file. |
|
|
if result goto fclose |
|
|
messagebox line 'test.txt' Display the line. |
|
|
goto loop Repeat until the end of the file. |
|
|
:fclose |
|
|
fileclose fhandle Close the file. |
|
22 |
</pre> |
</pre> |
23 |
|
|
24 |
</BODY> |
<h2>Remarks</h2> |
25 |
</HTML> |
|
26 |
|
<p> |
27 |
|
Reads a line from the file specified by <file handle>.<br> |
28 |
|
The line is written into the string variable <strvar>.<br> |
29 |
|
The file pointer is moved to the beginning of the next line.<br> |
30 |
|
If the file pointer reaches the end of the file while reading the line, the system variable "result" is set to 1. Otherwise, "result" is set to zero. |
31 |
|
</p> |
32 |
|
|
33 |
|
<h2>Example</h2> |
34 |
|
|
35 |
|
<pre class="macro-example"> |
36 |
|
<code>; Open a file. |
37 |
|
fileopen fhandle 'test.txt' 0 |
38 |
|
|
39 |
|
:loop |
40 |
|
; Read a line from the file. |
41 |
|
<strong>filereadln</strong> fhandle line |
42 |
|
if result goto fclose |
43 |
|
; Display the line. |
44 |
|
messagebox line 'test.txt' |
45 |
|
; Repeat until the end of the file. |
46 |
|
goto loop |
47 |
|
|
48 |
|
:fclose |
49 |
|
; Close the file. |
50 |
|
fileclose fhandle |
51 |
|
</code></pre> |
52 |
|
|
53 |
|
</body> |
54 |
|
</html> |