• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 125
  • Last Modified:

Access an opened file!

Hi
How to access an opened file for expample if I want to find out its size?
0
neox
Asked:
neox
1 Solution
 
intheCommented:
something like:

var
h: THandle;
wd ,wRead: DWORD;
fname: string;
begin
fname := 'c:\somefile.txt';
h  := CreateFile( PChar( fname ),
      GENERIC_READ,
      FILE_SHARE_READ,
      nil,
      OPEN_EXISTING,
      FILE_ATTRIBUTE_NORMAL + FILE_FLAG_SEQUENTIAL_SCAN,
      0 );
wRead := GetFileSize( h, @wd );
end;

Regards Barry
0
 
JaymolCommented:
There's a really easy way to do stuff to an open file......You can't open an open file, but you can copy it and then open the copy!

John.
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now