QB64.org Forum
Active Forums => QB64 Discussion => Topic started by: johannhowitzer on June 26, 2018, 07:18:15 pm
-
Hey, thanks for reading.
I know how to write values to binary files, but I would like to create actual text output that I could then copy over to a word processor. Is there a way to do this easily?
-
Open it for OUTPUT and use PRINT:
'SAMPLE CODE:
PRINT #1, "This is the first line of my text file" PRINT #1, "And this is the last."
-
Thanks!
-
You're welcome! And welcome to the forum!
-
Open "somerandomtextfile" for binary as c%
_clipboard$=input$(c%,lof(c%))
Close c%
Open your word processing executable. Select paste (usually control-v). Voila.
-
And, if you're used to working with BINARY, just put a CRLF character onto the end of each line of text.
Instead of: PUT #1, , text$
Instead: PUT #1, , text$ + CHR$(13) + CHR$(10) 'For Windows style line endings.