Two other ways to test for file exist:

by Solitaire (Login Solitaire1)
S

 

CLS
INPUT "Enter file name: ", filenom$
OPEN filenom$ FOR APPEND AS #1
N = LOF(1)
CLOSE #1
IF N = 0 THEN
    PRINT "File does not exist (or is empty)"
    KILL filenom$
ELSE
    PRINT "File "; filenom$; exists; ""
END IF
END

=================================================

CLS
flag = 0
INPUT "Enter filename: ", filenom$
ON ERROR GOTO check
OPEN filenom$ FOR INPUT AS #1
IF flag = 1 THEN
    PRINT "File does not exist."
    flag = 0
ELSE
    PRINT "File "; filenom$; "exists."
    CLOSE #1
END IF
END

check:
flag = 1
RESUME NEXT



    
This message has been edited by Solitaire1 on Mar 14, 2010 4:59 PM

Posted on Mar 14, 2010, 4:57 PM

Respond to this message   

Return to Index

Response TitleAuthor and Date
APPENDMarineDon on Mar 15

 Copyright © 1999-2014 Network54. All rights reserved.   Terms of Use   Privacy Statement