Step-by-step Usage Instructions
1.Add filenum.tbs and filenum.tbh files to your project (they are in current_library_set \filenum\trunk).
Add include "filenum\trunk\filenum.tbh" to the includes section of the global.tbh file.
Add #define FILENUM_MAX_FILENAME_LEN to the defines section of the global.tbh file; set it to the value that reflects the longest filename you are going to use.
Call filenum_get() whenever you need a free file number. Observe the result — if it is 255 then there are no free file numbers available!
Call filenum_release() when you no longer need a particular file number. This way, the file number can be reused by something else in your code.
Additional recommended steps
- The use of filenum_who_uses() is optional. This call will return a string signature left by the caller when obtaining the file number. FILENUM_MAX_SIGNATURE_LEN must be >0 for signatures to be saved.
We have provided a code snippet illustrating the use of the FILENUM library.
Using the FILENUM library? Then, use it everywhere in your code! Do not "appropriate" file numbers without going through this library.