Need help checking file e

 BBS: Inland Empire Archive
Date: 09-03-92 (21:13)             Number: 313
From: MATT HART                    Refer#: NONE
  To: TRENT SHIRLEY                 Recvd: NO  
Subj: Need help checking file e      Conf: (2) Quik_Bas
 TS> I need suggestions on how to check for the existance of a file
 TS> from Quick Basic 4.5

'
' EXIST.BAS  by Matt Hart
' Uses Interrupt 21H to see if a file exists.
'
    DEFINT A-Z
    TYPE RegTypeX
        ax    AS INTEGER
        bx    AS INTEGER
        cx    AS INTEGER
        dx    AS INTEGER
        bp    AS INTEGER
        si    AS INTEGER
        di    AS INTEGER
        flags AS INTEGER
        ds    AS INTEGER
        es    AS INTEGER
    END TYPE
    DECLARE FUNCTION Exist(File$)
    File$="EXIST.BAS"
    File$=command$
    Print Exist(File$)
    END
FUNCTION Exist(File$)
    DIM InRegs as RegTypeX
    DIM OutRegs as RegTypeX
    DIM DTA as string * 42
    DIM F as string * 64
    InRegs.AX = &H1A00
    InRegs.DS = VARSEG(DTA)
    InRegs.DX = VARPTR(DTA)
    CALL InterruptX (&H21, InRegs, OutRegs)
    F = File$+CHR$(0)
    InRegs.AX = &H4E00
    InRegs.CX = 0
    InRegs.DS = VARSEG(F)
    InRegs.DX = VARPTR(F)
    CALL InterruptX (&H21, InRegs, OutRegs)
    if OutRegs.AX = 2 or OutRegs.AX = 18 then
        Exist = 0
    else
        Exist = -1
    endif
END FUNCTION
---
 * Origin: Midnight Micro!  V.32/REL  (918)451-3306 (1:170/600)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET