Develop and Download Open Source Software

Browse Subversion Repository

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8939 - (show annotations) (download) (as text)
Thu Oct 1 16:06:58 2020 UTC (3 years, 7 months ago) by nmaya
File MIME type: text/html
File size: 1795 byte(s)
マクロコマンドが Tera Term バージョンいくつから存在するか、それぞれのマクロコマンドのヘルプページに記載

ticket #40808
MFT to: 4-stable
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>filetruncate</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>filetruncate</h1>
15
16 <p>
17 Changes the size of a file. <em>(version 4.67 or later)</em>
18 </p>
19
20 <pre class="macro-syntax">
21 filetruncate &lt;filename&gt; &lt;size&gt;
22 </pre>
23
24 <h2>Remarks</h2>
25
26 <p>
27 Changes the &lt;size&gt; bytes of a &lt;filename&gt; file.<br>
28 Null characters('\0') are appended if the file is extended.<br>
29 </p>
30
31 <p>
32 The system variable "result" value is set to 0 if the file size is successfully changed.
33 The system variable "result" value of -1 indicates an error.
34 </p>
35
36 <h2>Example</h2>
37
38 <pre class="macro-example">
39 ; Changes 32 bytes of a file.
40 filetruncate 'test.exe' 32
41 if result = -1 then
42 messagebox 'file truncate error' 'filetruncate'
43 else
44 messagebox 'file truncate success' 'filetruncate'
45 endif
46 </pre>
47
48 <pre class="macro-example">
49 ; Makes 8M bytes of a file containing all zero data.
50 size = 8*1024*1024
51 filetruncate 'bigfile.bin' size
52 </pre>
53
54 <pre class="macro-example">
55 ; Opens a log file at the macro file directory.
56 getdir dir
57 sprintf2 filename '%s\test.log' dir
58 logopen filename 0 0
59 ; Limitation of a file size
60 maxsize = 512
61 counter = 0
62
63 :loop
64 counter = counter + 1
65 sprintf2 line 'counter = %d' counter
66 logwrite line
67 logwrite #13#10
68 filetruncate filename maxsize
69 if result = -1 then
70 messagebox 'file truncate error' 'filetruncate'
71 goto skip
72 endif
73 if counter &gt; 32 goto skip
74 goto loop
75
76 :skip
77 logclose
78 </pre>
79
80 </body>
81 </html>

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