Re: Creating/saving/appending to files the Cocoa way
Re: Creating/saving/appending to files the Cocoa way
- Subject: Re: Creating/saving/appending to files the Cocoa way
- From: "John C. Welch" <email@hidden>
- Date: Mon, 18 Jan 2010 14:12:58 -0500
- Thread-topic: Creating/saving/appending to files the Cocoa way
On 1/17/10 6:07 PM, "Shane Stanley" <email@hidden> wrote:
>> Since I'm writing a string every second, (possibly faster), too much of a
>> slowdown could be annoying.
>>
> You're probably not going to notice any difference. I just did some simple
> tests, and make-NSString/make-NSData/use-NSFileHandle took about five times
> as long as using AS's write (using a single line of text). Sounds awful, but
> it's a case of 5,000 writes a second vs 25,000 a second -- academic if
> you're writing a small amount once a second.
>
>>> If you do use read/write, be aware that you have to enclose the commands in
>>> a
>>> "tell current application" for them to work.
>>>
>> Makes sense
>>
> I keep thinking it does, too, but I'm not sure why. Maybe I'll check the
> documentation...
So another question on this...looking at NSFileHandle, it doesn't look like
there's a good way to say "set the file pointer to <location> and start
writing *there*" other than slurping up the existing contents of the file,
re-writing them back, then adding in the new data.
Is this a correct reading of the docs?
--
God created assistant managers when he was in a really bad mood.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden