Re: Get Open file size

new topic     » goto parent     » topic index » view thread      » older message » newer message

--=====================_20412311==_.ALT

as I'm coding an entire library for random access files, i think know this one.
you can perform a seek command on the open file that will put the file pointer at
the end of the file. then read the file pointer again and you have the current
size. use code similar to this.

-- UNtested code follows
fn = open("data.fil","r")

-- puts pointer at end of file
tempatom = seek(fn,-1)
-- error handling for tempatom goes here

-- now get the current file pointer
filesize = where(fn)


At 08:28 AM 11/29/00 +0700, you wrote:
>How can I get file size/file length of opened file in eu?
>In VB I can use LOF(fn). By using dir() I only get size when the file
>last closed.

--=====================_20412311==_.ALT

<html>
<font size=3>as I'm coding an entire library for random access files, i
think know this one. you can perform a seek command on the open file that
will put the file pointer at the end of the file. then read the file
pointer again and you have the current size. use code similar to
this.<br>
<br>
-- UNtested code follows<br>
fn = open(&quot;data.fil&quot;,&quot;r&quot;)<br>
<br>
-- puts pointer at end of file<br>
tempatom = seek(fn,-1)<br>
-- error handling for tempatom goes here<br>
<br>
-- now get the current file pointer<br>
filesize = where(fn)<br>
<br>
<br>
At 08:28 AM 11/29/00 +0700, you wrote:<br>
<blockquote type=cite cite>How can I get file size/file length of opened
file in eu?<br>
In VB I can use LOF(fn). By using dir() I only get size when the
file<br>
last closed. </font></blockquote></html>

--=====================_20412311==_.ALT--

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu