Yes. Now there would be two files, with identical content.
Often a program displays its results on the screen, and saves the results in a file. Here is a program that computes the square roots of numbers from 1 to LIMIT. The user is asked to enter filename and a number for LIMIT.
' Write square roots of integers to a file ' and to the screen ' CLS INPUT "Enter file name:", NAME$ INPUT "Enter a limit:", LIMIT OPEN NAME$ FOR OUTPUT AS #1 PRINT #1, "Number", "Square Root" PRINT "Number", "Square Root" FOR N = 1 TO LIMIT PRINT #1, N, SQR(N) PRINT N, SQR(N) NEXT N END
Each PRINT
statement is done twice, once for the
screen and once for the file.
If a file can be opened, do you suppose it can be closed?