View Full Version : long text string in file

06-17-2009, 11:58 AM
I've been trying to figure out how to read in a text file with 10,000 characters in one line.

The DC_READ_FREE function in both WAVE 8.0 and 9.0 can only read 7422 characters per line, so that approach will not work.

Next, I tried the following in both 8.0 and 9.0:

filename = 'longchar.txt'
linstr = ''
OPENR, unit, filename, /GET_LUN
READF, unit, linstr
CLOSE, unit

9.0 worked, but 8.0 gave this message:

%%%Input line is too long for input buffer of 8192 characters.
%%%READF: Error encountered reading from file. Unit: 100
File: longchar.txt
%%%Execution halted at $MAIN$ (READF).

So, this may work in 9.0 -- but only up to the new buffer limit. What is the new buffer limit in WAVE 9.0?

Also, are there any other work-arounds if my text file exceeds the number of characters in the new buffer limit?

06-19-2009, 10:25 AM
We doubled the size of the input buffer in v9.0; going from 8192 in previous versions to 16384 for v9. So version 9 can handle the 10,000 char read as a single READF operation.

For v8 you'll have to use two reads per line (using POINT_LUN to define specific byte locations within the file and the line, and then READF). From there, you can either convert the bytes to strings and use the string manipulation routines to 'join' the line content, OR you can use array concatenation to put the line back together.

Hope this helps,

Don B.