Open-Source-Software-Entwicklung und Downloads

Browse Subversion Repository

Contents of /trunk/doc/en/html/macro/command/filestrseek2.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3227 - (show annotations) (download) (as text)
Tue Mar 24 15:10:33 2009 UTC (15 years, 1 month ago) by maya
File MIME type: text/html
File size: 1834 byte(s)
CVS から SVN へ移行: 改行コードを LF から CR+LF へ変換
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=iso-8859-1">
6 <title>filestrseek2</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>filestrseek2</h1>
15
16 <p>
17 Backward searchs a string from a file.
18 </p>
19
20 <pre class="macro-syntax">
21 filestrseek2 &lt;file handle&gt; &lt;string&gt;
22 </pre>
23
24 <h2>Remarks</h2>
25
26 <p>
27 Searches for &lt;string&gt; in the file specified by &lt;file handle&gt;.<br>
28 The search is done backward and started from the current position of the file pointer. For the forward search, use the "<a href="filestrseek.html">filestrseek</a>" command.<br>
29 If &lt;string&gt; is found, the file pointer is moved to the position of the character just before the string and the system variable "result" is set to 1. However, if the string locates at one byte of the file, the file pointer is zero offset.<br>
30 If &lt;string&gt; is not found, the file pointer is not moved and "result" is set to zero.<br>
31 If the file pointer is already zero before the execution of this command, "result" is set to zero.
32 </p>
33
34 <h2>Example</h2>
35
36 <pre class="macro-example">
37 ; Open the file "teraterm.log". The file pointer is set to the end of file.
38 fileopen fhandle 'teraterm.log' 1
39
40 :next
41 ; Backward search for the string "abc"
42 filestrseek2 fhandle 'abc'
43 if result=0 goto not_found
44 ; mark the file pointer
45 filemarkptr fhandle
46 ; Read characters from the character just before "abc" to the end of the line.
47 filereadln fhandle str
48 ; recall the file pointer
49 fileseekback fhanlde
50 ; search for the next word
51 goto next
52
53 :not_found
54 fileclose fhandle
55 </pre>
56
57 </body>
58 </html>

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26