Page 1 of 1

read txt error

Posted: 10.02.2016 1:34
by k-k
my tile.txt has that line, ex:

218,118-218,118-218,118-218,118-218,117-218,117

my code:

Code: Select all

Program TreeAnalyzer;
Var
    tiles : string;

procedure GetTiles;
var
   List : TStringList;
   i : integer;
begin
   List := TStringList.Create;
   List.LoadFromFile('D:\tiles.txt');
   for i := 0 to List.Count-1 do begin
      tiles := tiles + List.strings[i];
   end;           
end;   

Begin
    tiles := '';
    GetTiles;
    Addtosystemjournal(tiles);
End.   
script return this:
2

i need that script return all line in tile.txt. Where is error in code?

tnks =]

Re: read txt error

Posted: 10.02.2016 17:42
by Vizit0r

Code: Select all

15:10:49:781 [Inceptum - test]: Compiling
15:10:49:908 [Inceptum - test]: Compiled succesfully
15:10:49:912 [Inceptum - test]: 218,118-218,118-218,118-218,118-218,117-218,117
15:10:49:915 [Inceptum - test]: Succesfully executed
15:10:49:918 [Inceptum - test]: Script test_shrink.sc stopped successfuly
created file D:\tiles.txt with your line

your script.

so?

Re: read txt error

Posted: 10.02.2016 22:26
by k-k

Code: Select all

15:52:54:003 [Char Name]: Compiling
15:52:54:017 [Char Name]: Compiled succesfully
15:52:54:017 [Char Name]: 2
15:52:54:018 [Char Name]: Succesfully executed
15:52:54:019 [Char Name]: Script teste3.sc stopped successfuly
i dont understand, waht i do wrong?

edit1: when I create the tile.txt , the script works normal, but when the tile.txt is created by stealth , the script does not work right

edit2: i find the problem, srry for the post =]]]

Re: read txt error

Posted: 11.02.2016 21:53
by Vizit0r
np)

Re: read txt error

Posted: 13.02.2016 20:54
by Macks
k-k wrote:...
row

Code: Select all

tiles := tiles + List.strings[i];
change to

Code: Select all

tiles := tiles + List[i];