Warning: include(../mainbanner.htm) [function.include]: failed to open stream: No such file or directory in /home/makedata/public_html/delphibasics/seek.php on line 32

Warning: include(../mainbanner.htm) [function.include]: failed to open stream: No such file or directory in /home/makedata/public_html/delphibasics/seek.php on line 32

Warning: include() [function.include]: Failed opening '../mainbanner.htm' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/makedata/public_html/delphibasics/seek.php on line 32

Warning: include(../left.htm) [function.include]: failed to open stream: No such file or directory in /home/makedata/public_html/delphibasics/seek.php on line 53

Warning: include(../left.htm) [function.include]: failed to open stream: No such file or directory in /home/makedata/public_html/delphibasics/seek.php on line 53

Warning: include() [function.include]: Failed opening '../left.htm' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/makedata/public_html/delphibasics/seek.php on line 53
Delphi Basics

Seek procedure

Move the current position of a file go to the new position. Where the first position of file always from zero..

Unit
System

Syntax:
procedure Seek(var F; N: Longint);

Where F is a file variable that has been opened. N is number of position destination. If file accessed is typed file, hence position of file represent by number of record.
Seek(F,0) will be set file position to zero and Seek(F, FileSize(F)) moves the current file position to the end of the file.
{$I+} handles runtime errors using exceptions. When using {$I-}, use IOResult to check for I/O errors.

example:

procedure TForm1.BtnSeekClick(Sender: TObject);
var
  myFile : File of integer;
  output: integer;
  i: integer;
begin
  i:= StrToInt(Edit1.Text);
  {Try to open the Test.cus binary file 
    in write only mode}
  AssignFile(myFile, 'test.dat');
  Reset(myFile);
  Seek(myFile, i);
  Read(myFile, output);
  CloseFile(myFile);
  ShowMessage ('Position file is ' + IntToStr(i) +
   ' and the result is ' + IntToStr(output));
end;

Download source code.

back to top


Warning: include(../right.htm) [function.include]: failed to open stream: No such file or directory in /home/makedata/public_html/delphibasics/seek.php on line 140

Warning: include(../right.htm) [function.include]: failed to open stream: No such file or directory in /home/makedata/public_html/delphibasics/seek.php on line 140

Warning: include() [function.include]: Failed opening '../right.htm' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/makedata/public_html/delphibasics/seek.php on line 140


Warning: include(../ulink180x90.php) [function.include]: failed to open stream: No such file or directory in /home/makedata/public_html/delphibasics/seek.php on line 143

Warning: include(../ulink180x90.php) [function.include]: failed to open stream: No such file or directory in /home/makedata/public_html/delphibasics/seek.php on line 143

Warning: include() [function.include]: Failed opening '../ulink180x90.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/makedata/public_html/delphibasics/seek.php on line 143


Warning: include(../bottombanner.htm) [function.include]: failed to open stream: No such file or directory in /home/makedata/public_html/delphibasics/seek.php on line 157

Warning: include(../bottombanner.htm) [function.include]: failed to open stream: No such file or directory in /home/makedata/public_html/delphibasics/seek.php on line 157

Warning: include() [function.include]: Failed opening '../bottombanner.htm' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/makedata/public_html/delphibasics/seek.php on line 157