Delphi中的SeekEof用法實例,在Delphi中,seekeof 函數作用是返回文件的結束狀態,seekeof不讀文件尾空行,就和seekeoln不算行末空格一樣,此函數在導彈攔截一題中超有用,以下是一個例子供參考。
01
unit
Unit1;
02
interface
03
uses
04
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
05
Dialogs, StdCtrls;
06
type
07
TForm1 =
class
(TForm)
08
Button1: TButton;
09
procedure
Button1Click(Sender: TObject);
10
private
11
{ Private declarations }
12
public
13
{ Public declarations }
14
end
;
15
var
16
Form1: TForm1;
17
implementation
18
{$R *.dfm}
19
TForm1
.
20
21
f : System
TextFile;
22
i, j, Y :
Integer
23
begin
24
AssignFile(f,
'TEST.TXT'
);
25
try
26
Rewrite(f);
27
{ Create a file with 8 numbers and some
28
whitespace at the ends of the lines }
29
Writeln
(f,
'1 2 3 4 '
30
'5 6 7 8 '
31
Reset(f);
32
{ Read the numbers back. SeekEof returns TRUE if there is no
33
more text (other than whitespace) in the file. }
34
Y :=
5
35
while
not
SeekEof(f)
do
36
37
Read(f,j);
38
Canvas
TextOut(
, Y, IntToStr(j));
39
Y := Y + Canvas
TextHeight(IntToStr(j)) +
40
41
finally
42
CloseFile(f);
43
44
45
本例效果圖(用 gif 動畫演示, 無論如何也
Delphi可視化Ping命令,用來檢測網絡連接狀態,信息
Intersect {交集}Union {聯合}Xor
Delphi xe7 up1 調用android振動功能,x
TClIEntDataSet.UpdateStatus:
在編譯程序並運行後,Delphi2007會提示以下錯誤