• 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: Reading and writing records
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading and writing records


  • Subject: Re: Reading and writing records
  • From: Chris <email@hidden>
  • Date: Mon, 27 Aug 2007 00:13:57 +1000

Philip Aker wrote:
On 2007-08-25, at 02:03:43, Chris wrote:

The point is that if you want to use AppleScript list and record formatting in this way, you actually have to know the details of the binary file format for both lists and records and then concoct a few handlers to be able to do what AppleScript doesn't handle natively. And it's slow compared to all of the other choices.

I don't see why I need to know the binary format.

Because your question was:

"Does anyone have a code snippet for writing a list of records one at a time and reading them back one at a time until eof?"

The question does not imply a need to know the details of the format.

I've got no problem writing and reading the records.

Ok, so you didn't have to ask the question.

Yes I do.

It just seems strange that there is no way to check for eof.

get eof of f

That _get_s the location of eof, but it doesn't CHECK that you've _reached_ eof. And since there is no way that I can tell to find out where you have reached, it is pretty useless.



in AppleScript doesn't have the same connotation as EOF in C so you'd have to check for the accumulated read size being greater than get eof of f. But it's an alien concept for data types like AppleScript lists and records.

Nobody in the history of the world has checked for eof by keeping track of accumulated read size. That is an error prone proposition.



I don't see what having fixed size records has got to do with anything when you are reading sequentially.

List and record formats don't have ending delimiters and neither do the data types they commonly contain. Therefore, if one writes a type of known size, then they can read back a known size as a type.

Record formats probably (I'm guessing) have a a prefix stating size of its component pieces. Which is all details I don't care to know. I just want to know if I've reached eof.






_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: Reading and writing records
      • From: Michelle Steiner <email@hidden>
References: 
 >Re: Reading and writing records (From: has <email@hidden>)
 >Re: Reading and writing records (From: Chris <email@hidden>)
 >Re: Reading and writing records (From: Philip Aker <email@hidden>)
 >Re: Reading and writing records (From: Chris <email@hidden>)
 >Re: Reading and writing records (From: Philip Aker <email@hidden>)

  • Prev by Date: Re: getting duplicates in a list by item id
  • Next by Date: Re: Reading and writing records
  • Previous by thread: Re: Reading and writing records
  • Next by thread: Re: Reading and writing records
  • Index(es):
    • Date
    • Thread