Step-by-step Usage Instructions

Top  Previous  Next

Minimal steps

1. Add filenum.tbs and filenum.tbh files to your project (they are in current_library_set\filenum\trunk).

2. Add include "filenum\trunk\filenum.tbh" to the includes section of the global.tbh file.

3. 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.

4. 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!

5. 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

1.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.

 

note_warning-wt

Using the FILENUM library? Then, use it everywhere in your code! Do not "appropriate" file numbers without going through this library.