F.19 CloseCtFile
Close index or data file.
Short Name
CLSFIL
TYPE
Low level file function
DECLARATION
COUNT CloseCtFile(COUNT filno, COUNT filmod)DESCRIPTION
CloseCtFile closes file number filno.
The filmod parameter is no longer used. It has been left in this definition solely for the sake of compatibility with older versions. If you have programs that were developed with older versions of c-tree Plus, you don't have to change your CloseCtFile function calls. For newer programs, you can leave it out, unless you are using function prototyping and receive a warning about having too few parameters. In this case either use a second parameter, which will be ignored, or change the function prototype definition in ctdecl.h.
If filno references an index file with additional index members, CloseCtFile closes the primary index and its members.
CloseCtFile ensures a file is properly closed so updates will be properly saved to disk. In low-level mode, data files are updated by NewData, ReleaseData, and WriteData, and index files are updated by AddKey, DeleteKey, and DeleteKeyBlind.
RETURN
See Appendix A "c-tree Plus Error Codes" of the c-tree Plus Programmer's Reference Guide for a complete listing of valid c-tree Plus error values.
EXAMPLE
COUNT filno = 0, retval;TEXT filnam[15] = "sample.dat";if (retval = InitCtree(6,7,4))printf("\nCould not initialize. Error %d.", retval);else {if (OpenCtFile(filno, filnam, (ctSHARED | ctVIRTUAL | ctFIXED)))printf("\nCould not open file.");else if (CloseCtFile(filno, 0))printf("\nCould not close file.");if (CloseISAM())printf("\nCould not close ISAM.");}SEE ALSO
OpenCtFile, CreateDataFile, and CreateIndexFile.
|
FairCom Corporation www.faircom.com |