Problem opening/closing more Informix C-isam files
Posted in 2003
Topics: General Discussion
Hi, I have the following problem in Informix C-Isam under Windows 2000, with Microsoft Visual C/C++: I open f.e. 5 isam files together. Then I close these 5 files. The program gives an exception after opening the 3th file. It gives also an exception when I close the second file, if two files are open. Is there a problem with the c-isam library, or with the compilation option ? I use Informix C-Isam v.7.25 (mentioned on CD-ROM). Here the code of testing: #include <stdio.h> #include <fcntl.h> #include <sys/types.h> #include <sys/stat.h> #include <io.h> #include <errno.h> #include <isam.h> main() { int i,j; int fd[2048]; char fname[256]; int RecordSize=128; struct keydesc sKey; // Pointer to key descriptor sKey.k_flags = ISNODUPS; sKey.k_nparts = 1; sKey.k_part[0].kp_start = 0; sKey.k_part[0].kp_leng = 10; sKey.k_part[0].kp_type = CHARTYPE; for (i=1;i<100i++) { sprintf(fname,"c:\\\\temp\\\\file%04d",i); if ((fd[i] = isbuild(fname,RecordSize,&sKey,ISINOUT+ISEXCLLOCK)) < 0) { fprintf(stderr, "Error opening is file %s - errno: %d iserrno: %d\\n",fname, errno, iserrno); j=i-1; i=2048; } } for (i=1;i<j;i++) { if (isclose(fd[i]) < 0) { fprintf(stderr, "Error closing file %d\\n",i); } } printf("Program ended\\n"); exit(0); } Thanks for the answers, Stefan