Input From and Set

make

Member
Hi there,

i have a txt file called gl.txt.
The value in the file are 1,2,5,6,8,....
Now , i want to open this file an read the values into a string "1,2,5..." , i defined the string as Liste.
I wrote the little Program below, but i doesent work. The compiler breaks with an error message : File-Input too long : 1,2,5...

def stream Custlist.
def var inFile as char no-undo.
def var Liste as char no-undo.
inFile = "c:\ana\gl.txt".
input from value(inFile).
set liste. /* may here is the error ? */
input close.
display liste.

Can anyone help me ?

Greets
make
 
try this

def stream Custlist.

def var inFile as char no-undo.
def var Liste as char no-undo.

inFile = "c:\ana\gl.txt".

input stream Custlist from value(inFile).
import stream Custlist unformatted liste.
input stream Custlist close.
display liste.

(I presumed you wanted to use the stream Custlist having defined it)

You can use the set command, but import unformatted will import a whole line at a time, which i think is what you want. If this still doesnt work, then I think the problem is with your data. The maximum size of a character variable is 32K, so if your data is bigger than this, that is the problem. In this case, you will have to load the data in blocks and find a way to use it in these blocks.
 
Doesnt work

First, thanks for your help.
The little program works, but the result wich is displayed is emtpy.

Here is the procedure wich exported the values in the txt-file.
The Variable erg has values like the following : "1,2,5,6...999", may 250 different values.

procedure Export.
def input param Erg as char no-undo.
outfile = "c:\ana\gl.txt".
output stream strOut to value(outfile).
Put Stream strout unformatted erg.
output stream strOut close.
END PROCEDURE.

I dont understand why nothing is displayed in your Program.

Make
 
Try adding a cr/lf to the file

e.g. Produce the file with:

procedure Export.
def input param Erg as char no-undo.
outfile = "c:\ana\gl.txt".
output stream strOut to value(outfile).
Put Stream strout unformatted erg skip.
output stream strOut close.
END PROCEDURE.
 
Back
Top