Re: Any way to get "file pointer"?
Re: Any way to get "file pointer"?
- Subject: Re: Any way to get "file pointer"?
- From: Shane Stanley <email@hidden>
- Date: Sat, 02 Jun 2018 12:22:52 +1000
On 2 Jun 2018, at 10:18 am, Gil Dawson <email@hidden> wrote:
>
> I'm looking for the number of bytes I've read so far.
The short answer, as Chris said, is that there is no such command.
The longer answer is that both your code and proposed workaround are based on
using the default encoding, which in most cases means MacRoman. And unless
you're also writing the original files in AppleScript, or you know they will
never include characters outside the strict ASCII set, that's a recipe for
corruption. Virtually nothing writes text files in MacRoman these days, and
certainly not with linefeeds as line breaks.
Also, using read with a delimiter repeatedly instead of just reading and
getting the paragraphs was, last I checked, a much, much slower option.
And if you move to more sensible encoding like UTF-8, keeping track of the file
mark is generally fraught with danger anyway, because you lose the equivalence
of bytes and characters.
--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>
_______________________________________________
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