The problem with that code is that only the last number STR$(nn) is receiving the LF terminator, the others aren't.JMR wrote: ↑Wed 12 Mar 2025, 09:51 I've now replaced what I'd had with the following:Code: Select all
PRINT#outfile%,STR$(nc),STR$(nh),STR$(no),STR$(nn) BPUT#outfile%,LF
When you PRINT the numbers to the screen you are separating them by spaces, but when you are writing them to the file you are separating them by carriage returns.
If you want the file to contain the same as was written to the screen, then separate the numbers with spaces in both cases:
Code: Select all
PRINT nc;" ";nh;" ";no;" ";nn : REM Output to screen
PRINT#outfile%, STR$(nc)+" "+STR$(nh)+" "+STR$(no)+" "+STR$(nn) : REM Output to file
BPUT#outfile%,LF
It isn't. To output to a file what is sent to the screen simply use *SPOOL (it outputs to both the screen and the file):All I require is to write all results that appear on the screen, to a text file ...it can't be that difficult.
Code: Select all
OSCLI "SPOOL " + CHONRESULTS$
PRINT nc;" ";nh;" ";no;" ";nn
*SPOOL
Code: Select all
outfile% = OPENOUT(CHONRESULTS$)
OSCLI "OUTPUT " + STR$outfile%
PRINT nc;" ";nh;" ";no;" ";nn
*OUTPUT
CLOSE #outfile%