Dim fileNum As Integer
Dim fileName As String
fileName$ = "data.txt"
fileNum% = FreeFile()
Open fileName$ For Output As fileNum%
Width #fileNum%, 20
Print #fileNum%, "First line";
' The next data item, a long string, would extend the
' current line beyond 20 characters; so it is written
' to the next line in the file. An individual data item
' cannot be split across lines; so the entire 33-character
' string is written to one line.
Print #fileNum%, "This will go on one line, though.";
' The next data item is written to the next line
' in the file because the current line is already wider
' than 20 characters.
Print #fileNum%, "But this is on another.";
Print #fileNum%, "The End";
Close fileNum%
' Output:
' First line
' This will go on one line, though.
' But this is on another.
' The End