DECLARE SUB fINITIALIZE
DECLARE FUNCTION GetFileNum() AS LONG
DECLARE SUB fOPEN(fNum AS LONG, fName$ AS STRING, fHow AS LONG)
DECLARE SUB fCLOSE(fNum AS LONG)
DECLARE SUB fPOSITION(fNum AS LONG, fPosition AS LONG)
DECLARE SUB fWRITELINE(fNum AS LONG, fString AS STRING)
DECLARE FUNCTION fSIZE(fNum AS LONG) AS LONG
DECLARE FUNCTION fREADBINSTR(fNum AS LONG, fBytes AS LONG) AS STRING
CONST MaxQFiles=8
DIM qf1 AS QFILESTREAM
DIM qf2 AS QFILESTREAM
DIM qf3 AS QFILESTREAM
DIM qf4 AS QFILESTREAM
DIM qf5 AS QFILESTREAM
DIM qf6 AS QFILESTREAM
DIM qf7 AS QFILESTREAM
DIM qf8 AS QFILESTREAM
DIM qfn(1 TO MaxQFiles) AS BYTE
DIM qfi AS LONG
SUB fINITIALIZE
FOR qfi=1 TO MaxQFiles: qfn(qfi)=0: NEXT qfi
END SUB
FUNCTION GetFileNum() AS LONG
Result=-1
FOR qfi=1 TO MaxQFiles
IF qfn(qfi)=0 THEN Result=qfi: EXIT FUNCTION
NEXT qfi
END FUNCTION
SUB fOPEN(fNum AS LONG, fName$ AS STRING, fHow AS LONG)
qfi=fHow
IF FILEEXISTS(fName$)=0 THEN qfi=fmcreate
SELECT CASE fNum
CASE 1: qf1.OPEN(fName$,qfi)
CASE 2: qf2.OPEN(fName$,qfi)
CASE 3: qf3.OPEN(fName$,qfi)
CASE 4: qf4.OPEN(fName$,qfi)
CASE 5: qf5.OPEN(fName$,qfi)
CASE 6: qf6.OPEN(fName$,qfi)
CASE 7: qf7.OPEN(fName$,qfi)
CASE 8: qf8.OPEN(fName$,qfi)
END SELECT
qfn(fNum)=1
END SUB
SUB fCLOSE(fNum AS LONG)
SELECT CASE fNum
CASE 1: qf1.CLOSE
CASE 2: qf2.CLOSE
CASE 3: qf3.CLOSE
CASE 4: qf4.CLOSE
CASE 5: qf5.CLOSE
CASE 6: qf6.CLOSE
CASE 7: qf7.CLOSE
CASE 8: qf8.CLOSE
END SELECT
qfn(fNum)=0: DOEVENTS
END SUB
SUB fPOSITION(fNum AS LONG, fPosition AS LONG)
SELECT CASE fNum
CASE 1: qf1.Position=fPosition
CASE 2: qf2.Position=fPosition
CASE 3: qf3.Position=fPosition
CASE 4: qf4.Position=fPosition
CASE 5: qf5.Position=fPosition
CASE 6: qf6.Position=fPosition
CASE 7: qf7.Position=fPosition
CASE 8: qf8.Position=fPosition
END SELECT
END SUB
FUNCTION fSIZE(fNum AS LONG) AS LONG
SELECT CASE fNum
CASE 1: Result=qf1.Size
CASE 2: Result=qf2.Size
CASE 3: Result=qf3.Size
CASE 4: Result=qf4.Size
CASE 5: Result=qf5.Size
CASE 6: Result=qf6.Size
CASE 7: Result=qf7.Size
CASE 8: Result=qf8.Size
END SELECT
END FUNCTION
FUNCTION fReadBinStr(fNum AS LONG, fBytes AS LONG) AS STRING
SELECT CASE fNum
CASE 1: Result=qf1.ReadBinStr(fBytes)
CASE 2: Result=qf2.ReadBinStr(fBytes)
CASE 3: Result=qf3.ReadBinStr(fBytes)
CASE 4: Result=qf4.ReadBinStr(fBytes)
CASE 5: Result=qf5.ReadBinStr(fBytes)
CASE 6: Result=qf6.ReadBinStr(fBytes)
CASE 7: Result=qf7.ReadBinStr(fBytes)
CASE 8: Result=qf8.ReadBinStr(fBytes)
END SELECT
DOEVENTS
END FUNCTION
SUB fWriteLine(fNum AS LONG, fString AS STRING)
SELECT CASE fNum
CASE 1: qf1.WriteLine(fString)
CASE 2: qf2.WriteLine(fString)
CASE 3: qf3.WriteLine(fString)
CASE 4: qf4.WriteLine(fString)
CASE 5: qf5.WriteLine(fString)
CASE 6: qf6.WriteLine(fString)
CASE 7: qf7.WriteLine(fString)
CASE 8: qf8.WriteLine(fString)
END SELECT
DOEVENTS
END SUB
|