Allocates and initializes a memory file
| Call | ||
| #include <vv_sys.h> | ||
| MFILEPTR mf_def(maxrows, maxcols) | ||
|
int maxrows |
Maximum number of rows that can be in memory file |
|
| int maxcols | Maximum number of columns that can be in the file | |
| maxcols: Specify the maximum number of columns on any one row, not including the null terminator that ends each row | ||
| Returns | ||
| POINTER | A pointer to the memory file structure. | |
| NULLP | Error. The global error variable VV_ERR is set to: | |
| MEMLACK | There is insufficient memory to allocate for the memory file structure and the array of pointers to the MFLINE structures. | |
| Description
mf_def() allocates a memory file structure with a call to mem_get() and assigns initial values to the memory file structure members based on the arguments passed in the mf_def() call. The display of the top-of-file and bottom-of-file messages is set by default to OFF. The memory file is set to operate on the entire memory file and not any specific keyword section. Memory is also allocated for a memory file line array, which is an array of pointers to MFLINE structures. MFLINE structures are used to hold information about each row in the memory file. The additional item in the array is for an end-of-file marker. All elements of the array are initialized to NULLP. The pointer to this array is stored in the memory file structure. |
||
| Related Functions | ||
| Cautions
The memory file structure and its associated array of MFLINE pointers are allocated by this function. To free them, call mf_free(). PCDOS and OS/2 Systems: The maximum number of rows is limited to 32767 rows for small memory models (two-byte pointers) and 16383 rows for large memory models (four-byte pointers). This is because many PCDOS and OS/2 C compilers limit a data item to 64K bytes. 32768 two-byte pointers fit in a 64K byte object whereas only 16384 four-byte pointers fit in 64K. Note that list of pointers is null terminated thus 32767 and 16383. Terminal-based Systems: The maximum number of rows is based on the size of a pointer and the largest block of memory that calloc() can allocate in a single call, such that: maxrows <= Largest block of memory from calloc() / Size of pointer |
||