read from file
Blitz3D Forums/Blitz3D Beginners Area/read from file
| ||
This piece of code doesn't work... why?If num = 0 file = ReadFile("aaa.txt") While Not Eof(file) tex1.tex = New tex tex1\let = ReadString$(file) Wend CloseFile(file) EndIf num = 1 For tex1.tex = Each tex Text x,y,tex1\let x = x + 8 If x > 455 Then y = y + 15 : x = 30 Next x = 30 y = 30 The readstring$ command gives me an error. P.s. the file exists |
| ||
you need to use readline if you haven't used writestring to write strings in the file. Readline reads each line from the start, whereas readstring reads a string where the first values holds the length, i think, of the string. |
| ||
But using readline i see no way to add a return between some words... I need this text to be formatted... I hope i am clear. Is there a way to add a return in the middle of a line? |
| ||
I don't see a type declaration? What error do you get? (To save time, if its "Memory access violation", turn Debug on, then try the code again). |
| ||
This is a "piece" of code Gfk... I have a Memory access violation and the debug is on... :( |
| ||
Then what Sinu said is most likely correct. Even if you managed to get your text into Blitz, none of the text commands (Text, Print etc) support carriage return or linefeeds anyway, so you'd still have to parse it yourself. |
| ||
Sob. OK thanks anyway. |