• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: get eof real?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: get eof real?


  • Subject: Re: get eof real?
  • From: Paul Berkowitz <email@hidden>
  • Date: Fri, 26 Sep 2003 08:44:00 -0700

On 9/25/03 9:19 PM, "David Crowe" <email@hidden> wrote:

> I'm executing the following AppleScript code:
>
> set theFileSize to (get eof FileRef)
> display dialog "theFileSize=" & theFileSize & ", class=" &
> (class of theFileSize) as string
>
>
>
> .... and the class of "theFileSize" comes up as "real". I understood
> that "get eof" returned an integer.
>
> Can anyone explain this. As far as I can tell the variable
> "theFileSize" is not involved in any calculations that might return a
> non-integer result.

Check the dictionary:

get eof anything -- a reference number, alias, or file reference of a file
that has been opened for access
Result: double integer -- the total number of bytes in the file

'double integer' is a real. It means it's a floating point, a 'double', not
a standard integer.

Files can be enormous. The number of bytes in a file can exceed the limit
for integer, so this way it's still possible to get eof, since the limit for
'double integer' is that of a real - if there even is one. Floating point
numbers may sometimes be represented as fractional when they get large
enough, since they're not decimal.

Some else will have more detail on these limits. The limit for integer seems
to be (2 ^ 29) - 1 whereas I don't know what the limit is on doubles/reals:
2 ^ 128 is still OK, for example, on a G3. I'm not even going to try it on
my G5...

You can just coerce your result 'as integer' which will work fine until you
hit 2 ^ 29. You may want to use a try block.

--
Paul Berkowitz
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: get eof real?
      • From: Shane Stanley <email@hidden>
    • Re: get eof real?
      • From: Emmanuel <email@hidden>
References: 
 >get eof real? (From: David Crowe <email@hidden>)

  • Prev by Date: Illustrator and Filemaker interaction
  • Next by Date: Sending multiple files to an application
  • Previous by thread: Re: get eof real?
  • Next by thread: Re: get eof real?
  • Index(es):
    • Date
    • Thread