Hi Rob,
Thanks for the quick fix. This seems to work fine. There was no significant thought process involved in my choice of "freads", so my only investment in it is ignorance.

Thanks again,
Dave Porter

Rob Hodgkinson wrote:
Thanks Dave, I was able to run this on my Mac (also in J602 by only changing
the one instance of y. to y in the script you sent at the bottom here).

The problem is in using the supplied routine <freads> to read the file.

I opened the file natively and inspected the size using ...
   $ 1!:1 <'/Users/robhodgkinson/FPF/flirpics/Run43.FPF'
1311612
   $ 1!:1 <'/Users/robhodgkinson/FPF/flirpics/Run44.FPF'
1311612                         NB. Same size ???  ... Suspicious ...

So then tried ...

   $ freads <'/Users/robhodgkinson/FPF/flirpics/Run43.FPF'
1311613
   $ freads <'/Users/robhodgkinson/FPF/flirpics/Run44.FPF'
1311572

I don't know <freads> well enough to explain its assumptions, but it does
appear to use <toJ> to substitute LF for CR, and adjusts for LF at the end
and other things (just view freads to see this further).

So you need to substitute the following line of code in your script:

dat=:freads y.

for one of the following three choices (I believe):
===========================================================================
dat=:1!:1@< y.    NB. J file read command (foreign conjunction)

dat=:nread y.     NB. require 'nfiles'
                  NB. defaults to <82 nread>, so data as raw 8 bit char

dat=:fread y.     NB. Same as <freads> but data appears not to be modified
                  NB. default case is <'' fread> which exits before toJ call
===========================================================================
Perhaps a more experienced J person using files may shed more light on the
best choice and why.  I briefly tried <fread> and it worked (so did nread),
but I would think <nread> (which appears to be just like the []nread in STSC
APL, which just returns the faw file data) may be the best choice.

Regards,
Rob Hodgkinson


(snip)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to