Re: Readf and line lenght limit [message #917] |
Fri, 19 March 1993 02:54 |
knipp
Messages: 68 Registered: January 1993
|
Member |
|
|
In article LG5@news.cis.umn.edu, patel@euler.ee.umn.edu (Maqbool Patel) writes:
> I am reading a file with the following line
>
> while (not eof(lun)) do begin
> if(temp eq 'nt') then readf,lun,nnt
> print,ni
> end
>
> I get an error message like:
>
> % Input line is too long for input buffer of 2048 characters.
> % READF: Error encountered reading from file. Unit: 119
> File: /home/users/patel/csi_data/fw2dcsi.fid/procpar
> % Execution halted at READPROCPAR <read_procapr.pro( 54)> (READF).
> % Called from $MAIN$
>
> ...
Try to read in the file as a byte-array:
; (assume file contains 3 lines:
; 1st with one char. \
; 2nd with 2001 char.s + <cr>
; 3rd with 4002 char.sp / )
openr, unit, file, /get_lun ; open, get filesize, read, close
f_info = fstat(unit)
i = assoc(unit,bytarr(f_info.size))
byte_text = i(0)
free_lun, unit
help,byte_text
BYTE_TEXT BYTE = Array(6007)
pos = where(byte_text eq 10b) ; find carriage-returns: <cr> = 10b
help, pos
POS LONG = Array(3)
print, pos
1 2003 6006
t1=string(byte_text(0:1)) ; re-arrange, convert to string
t2=string(byte_text(2:2003))
t3=string(byte_text(2004:6006))
print, strlen(t1), strlen(t2), strlen(t3)
2 2002 4003
There may be a more sophisticated way, but this works (in Pv~Wave).
K.Knipp
__ ____ __
/ // _ \ / / Karlheinz Knipp Tel. 0511 - 762 4922
/ // /_/ // / Uni Hannover Fax. 0511 - 762 2483
/ // ____// / Institut fuer Photogrammetrie
/ // / / / Nienburger Str.1 email knipp@ipi.uni-hannover.de
/_//_/ /_/ FRG 3000 Hannover 1
|
|
|
Re: Readf and line lenght limit [message #923 is a reply to message #917] |
Tue, 16 March 1993 04:40  |
zawodny
Messages: 121 Registered: August 1992
|
Senior Member |
|
|
In article <C3yCw0.LG5@news.cis.umn.edu> patel@euler.ee.umn.edu (Maqbool Patel) writes:
** Edited freely. **
> I get an error message like:
>
> % Input line is too long for input buffer of 2048 characters.
> % READF: Error encountered reading from file. Unit: 119
> File: /home/users/patel/csi_data/fw2dcsi.fid/procpar
> % Execution halted at READPROCPAR <read_procapr.pro( 54)> (READF).
> % Called from $MAIN$
>
> I see in my input file a line which is really long (>2048 chars).
> I am reading an ascii file and I have to read it as such.
I also had this problem just recently. Since it was a one time thing
for me, I decided to brute force it. I read the file in 80 character chunks
(the file was organized so that this was a natural length to use) into a byte
variable via the ASSOC function and then used the really neat function READS
to get the info in to the variables I wanted to use. Maybe something like
this will work for you as well.
Obviously, I too would like to know the "right way" to do this.
--
Joseph M. Zawodny (KO4LW) NASA Langley Research Center
Internet: zawodny@arbd0.larc.nasa.gov MS-475, Hampton VA, 23681-0001
Packet: ko4lw@wb0tax.va.usa
|
|
|