DECLARE SUB DQBopenDataFile (FileName AS STRING, Password AS STRING)
FileName - Datafile to open
Password - Password for data decoding
> 0 Operation successful > 1 Cannot open file or file does not exist > 2 General file reading error > 3 Bad datafile format > 4 Can't open two datafiles at once
Opens a datafile and sets decoding password. The datafile must have been created by the DQB DataFile Encoder program, or any other program able to generate DQB compatible datafiles. Password can be any string up to 8 chars.
As password, you can also pass a null string, meaning the datafile is not password-protected. You cannot open two datafiles at once: if you need to access the data that's stored onto another file, you must first close the current opened one with the DQBcloseDataFile function. See also DQBunpackImage, DQBunpackSprite, DQBunpackSound, DQBunpackPal, DQBunpackBMap, DQBunpackFont, DQBunpackCursor, DQBunpackUser, and appendix C for the datafile file format
*****************************************************************************
' This example assumes there's a datafile named TEST.BIN, containing an image
' whose ID is SAMPLE (stored into TEST.BI).
' All integers for speed
DEFINT A-Z
'$INCLUDE:'DIRECTQB.BI'
' Here we include the BI file generated by DQBENC for our datafile
'$INCLUDE:'TEST.BI'
' Let's initialize the library with no extra layers nor sounds nor EMS
IF DQBinit(0, 0, 0) THEN DQBclose: PRINT DQBerror$: END
' Opens datafile TEST.BIN, using password PASS
IF DQBopenDataFile("TEST.BIN","PASS") THEN DQBclose: PRINT DQBerror$: END
' Setups VGA
DQBinitVGA
' Unpacks on the screen from TEST.BIN the image whose ID is SAMPLE, placing
' it at coordinates (0,0)
IF DQBunpackImage(SAMPLE, VIDEO, 0, 0) THEN DQBclose: PRINT DQBerror$: END
' Waits for the user to press a key
WHILE INKEY$ = "": WEND
' Closes datafile (not really needed here, as DQBclose does it automatically)
DQBcloseDataFile
' Ends program
DQBclose
END
*****************************************************************************