RESET Statement ---------------------------------------------------------------------------- Action Closes all disk files. Syntax RESET Remarks The RESET statement closes all open disk files and writes data still in the file buffers to disk. See Also CLOSE, END, SYSTEM Example The following example opens several files for sequential output, then performs a RESET. The program attempts to write to the previously opened files. The error that occurs is trapped and a message is printed indicating that all files have been closed using the RESET statement. DEFINT A-Z ON ERROR GOTO ErrHandler ' Set up the error-handling routine. CLS FOR I = 1 TO 3 OPEN "Test" + RIGHT$(STR$(I), 1) + ".dat" FOR OUTPUT AS FREEFILE PRINT "File #"; I; "has been opened for output." NEXT I PRINT . PRINT "Press any key to reset all open files." PRINT Z$ = INPUT$(1) RESET FOR I = 1 TO 3 PRINT "Trying to write to file #"; I PRINT #I, "Test data" NEXT I END ErrHandler. ' Error 52 is "Bad file name or number" IF ERR = 52 THEN PRINT " File #"; I; "not open. RESET closed it." RESUME NEXT