You can have up to 32 files open at once.
To begin using a file you must open it with either:
OPEN FILE TO READ filenum, filename$
or
OPEN FILE TO WRITE filenum, filename$
Choose the language depending upon the task you wish to perform.
When you are done using the file it is a good idea to use CLOSE FILE filenum to close the file just to make sure.
Once you have a file open you can read from it, or write to it depending on the command you used to open it.
There are six types of values you can read from/write to files.
FILE
BYTE
WORD
LONG
FLOAT
STRING
I haven't worked out the intricacies of each file type yet, I'll need to dig up that old DarkBasic book to get the specifics. Basically you determine what type of value you need to write/read depending upon the limitations of each data type. Then you can use a command such as:
READ STRING filenum, var$
Where filenum is an open file and var$ is the string variable you wish to store the value in. You can also use arrays with read/write statements instead of just plain variables. Also, STRING can be any of the above mentioned data types.
Two other important commands are FILE OPEN() and FILE END(). These will return a 1 if a file is open (in the case of FILE OPEN() ) or if you have reached the end of a file (in the case of FILE END() ). Once you have reached the end of a file anymore data you read from it is worth moot. I don't know if DBC can pick out individual lines from a file, I've just been making due with closing and opening the file again and keeping track of where different things are located.
There are also many file management a directory commands. Those should be easy enough to figure out if you read the help file. It's just basic DOS stuff.
Crazy Donut Productions, Current Project: Project Starbuks
Sony stole our name!
