Loading carriage return?

Blitz3D Forums/Blitz3D Beginners Area/Loading carriage return?

Angel(Posted 2003) [#1]
Is it possible to load a carraige return in a textarea? After using the File Requester, I mean. For example, here is my code:

<code>
Select WaitEvent()
Case $1001 ;menu event
Select EventData()
Case 5:
filename$=RequestFile$("Open File","txt,htm,html,doc,pdf,dat",False)
If filename<>0 Then
filein=ReadFile(filename$)
SetTextAreaText textarea1,""
While Not Eof(filein)
theline$=ReadLine$(filein)
AddTextAreaText textarea1,theline$
Wend
CloseFile(filein)
EndIf
</code>

There's more than just that, but that's the important stuff. It opens the file just fine, but it all runs together, without putting the lines from the text file into their own lines in the textarea.

Here's something else I tried, but it wouldn't work AT ALL:
<code>
Select WaitEvent()
Case $1001 ;menu event
Select EventData()
Case 5:
filename$=RequestFile$("Open File","txt,htm,html,doc,pdf,dat",False)
If filename<>0 Then
filein=ReadFile(filename$)
SetTextAreaText textarea1,""
While Not Eof(filein)
a=a+1
theline$=ReadLine$(filein)
SetTextAreaText textarea1,theline$,a,1,2
Wend
CloseFile(filein)
EndIf
</code>

Any help?

also---i was guessing on how to set aside the code, by using "< code>" and "< /code>" ...so if this doesn't show up right can someone please tell me how to do this properly? thanks.


EOF(Posted 2003) [#2]
Chr$(13) is RETURN

So,

theline$=ReadLine$(filein)+chr$(13) would add a RETURN on the end.

Chr$(10) is a line break as well I think.


soja(Posted 2003) [#3]
...and to answer the other question, use "[" and "]" instead of "<" and ">".

See the FAQ for more forum codes.


Angel(Posted 2003) [#4]
Ah, THANKS!!! I am indeed in your guys' debts...