1. Get Open file size

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.

new topic     » topic index » view message » categorize

2. Re: Get Open file size

--=====================_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 message » categorize

3. Re: Get Open file size

Thanks very much for your help.
______________________________________________________________________
O> 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
O> file pointer again and you have the current size. use code similar to this.

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

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

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


O> 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.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu