Browse Subversion Repository
Contents of /trunk/doc/jp/html/macro/command/filereadln.html
Parent Directory
| Revision Log
1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
2 |
"http://www.w3.org/TR/html4/strict.dtd"> |
3 |
<html> |
4 |
<head> |
5 |
<meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"> |
6 |
<title>filereadln</title> |
7 |
<meta http-equiv="Content-Style-Type" content="text/css"> |
8 |
<link rel="stylesheet" href="../../style.css" type="text/css"> |
9 |
</head> |
10 |
|
11 |
<body> |
12 |
|
13 |
|
14 |
<h1>filereadln</h1> |
15 |
|
16 |
<p> |
17 |
ファイルから一行読む。 |
18 |
</p> |
19 |
|
20 |
<pre class="macro-syntax"> |
21 |
filereadln <file handle> <strvar> |
22 |
</pre> |
23 |
|
24 |
<h2>解説</h2> |
25 |
|
26 |
<p> |
27 |
ファイルハンドル <file handle> で指定されるファイルから一行読む。<br> |
28 |
読み込まれた行は、文字列変数 <strvar> に格納される。<br> |
29 |
ファイルポインタは次の行の始めへ移動する。もし、行を読んでいる間にファイルポインタがファイルの<br> |
30 |
最後に達した場合、システム変数 result に 1 が格納される。それ以外の場合、result に 0 が格納される。 |
31 |
</p> |
32 |
|
33 |
<h2>例</h2> |
34 |
|
35 |
<pre class="macro-example"> |
36 |
<code>; ファイルオープン |
37 |
fileopen fhandle 'test.txt' 0 |
38 |
|
39 |
:loop |
40 |
; 一行読み込み |
41 |
<strong>filereadln</strong> fhandle line |
42 |
if result goto fclose |
43 |
; 読み込んだ行を表示 |
44 |
messagebox line 'test.txt' |
45 |
; ファイル最後まで繰り返す |
46 |
goto loop |
47 |
|
48 |
:fclose |
49 |
; ファイルクローズ |
50 |
fileclose fhandle |
51 |
</code></pre> |
52 |
|
53 |
</body> |
54 |
</html> |
|