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 が格納される。<br> |
31 |
|
32 |
改行のみの場合は、文字列変数は空となり、result には 0 が格納される。 |
33 |
|
34 |
</p> |
35 |
|
36 |
<h2>例</h2> |
37 |
|
38 |
<pre class="macro-example"> |
39 |
<code>; ファイルオープン |
40 |
fileopen fhandle 'test.txt' 0 |
41 |
|
42 |
:loop |
43 |
; 一行読み込み |
44 |
<strong>filereadln</strong> fhandle line |
45 |
if result goto fclose |
46 |
; 読み込んだ行を表示 |
47 |
messagebox line 'test.txt' |
48 |
; ファイル最後まで繰り返す |
49 |
goto loop |
50 |
|
51 |
:fclose |
52 |
; ファイルクローズ |
53 |
fileclose fhandle |
54 |
</code></pre> |
55 |
|
56 |
</body> |
57 |
</html> |
|