OpenIFile Incremental ISAM open. Short Name OPNIFIL() Type ISAM function Declaration COUNT OpenIFile(pIFIL ifilptr) Description OpenIFile() opens the data file and (optional) index file referenced by the IFIL structure pointed to by ifilptr. The file name pointed to by the IFIL structure, ifilptr->pfilnam, should NOT include an extension: .dat and .idx are automatically appended to the file name for the data file and index file, respectively. The extended version of this function, OpenIFileXtd(), can change the file extensions at run time. If you desire the files to be opened in directories that are not specified until run-time, then ifilptr->pfilnam should not be finalized until run-time. Consecutive file numbers are assigned to the data file and any (optional) indices associated with the data file. The IFIL structure contains two file numbers: a permanent file number (dfilno), and a temporary file number (tfilno). If dfilno is less than zero, c-tree Plus finds the first available block of sufficient consecutive file numbers. If such a block of numbers is found, then the first number in the block is assigned to the data file and to tfilno. If dfilno is greater than or equal to zero, then dfilno is assigned to the data file and to tfilno. Note: This function supports EXCLUSIVE file opens. For more information, please refer to “Multi-user File Mode” Return Upon successful open, ifilptr->tfilno contains the file number assigned to the data file; and the associated indices are assigned consecutive index numbers starting one (1) greater than the data file number. On a successful open when a differently named file matches the file ID of an open file, the error return will be NO_ERROR (0) but sysiocod will be set to MFID_COD (-586). If the files are detected to actually be different, then the file ID is changed as discussed above and sysiocod is not set to MFID_COD.
See c-tree Plus Error Codes for a complete listing of valid c-tree Plus error values. Example extern IFIL myfile; COUNT retval;
printf("\nCould not close files. Error %d.", retval);
else {
if (CreateIFile(&myfile)) printf("\nCould not create %s (%d,%d)\n",
myfile- >pfilname, isam_err, isam_fil); else if (CloseIFile(&myfile)) printf("\nCould not close files.");
if (OpenIFile(&myfile)) printf("\nCould not open files.");
else if (CloseIFile(&myfile)) printf("\nCould not close files.");
printf("\nCould not close ISAM.");
} Limitations The index files will be numbered consecutively following the data file. See “File numbering” in the index for additional information. See also InitISAM(), CreateIFile(), CloseISAM(), OpenIFileXtd(), OpenFileWithResource(), GetIFile() and “ISAM Functions” in the c-tree Plus Programmer’s Reference Guide, which describes the ISAM parameters. |
|||||||||||||||||||||||||||||||||||||||