LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CVI MSVC inifile UIETooManyFilesOpen

I'm using LabWindows\CVI 7.1 and Microsoft Visual Studio 6.0

My project reads and saves data to an ini file using the CVI inifile.c  (inifile.fp)

Compiling and Running this in Labwindows alone it works,
but when I try to compile it and run it with Visual Studio there is not output to the inifile.
I've stepped thought the code and found that I and error about Too Many Files Open
specifically, UIETooManyFilesOpen

very similar to:
http://forums.ni.com/ni/board/message?board.id=231&message.id=1206&requireLogin=False

The above post mentions that there is a known bug in CVI for this, but this post was back in 2002.
I can't find any other info on this 'bug' other than the above post.

So, does anyone know if this is still a bug...  looks like it to me.

Thanks
Gary





0 Kudos
Message 1 of 4
(3,187 Views)
I think I came up with a temporary fix.

In Toolbox.c I needed to modify two functions:
GetfileWritability
CreteAndOpenTemporaryFile
both these functions call the defective GetFileInfo as seen below.  I simply changed that call to the working FileExists.
FileExits returns the need 1 or 0, but it will not catch a true Too Many File handles open error

//switch (GetFileInfo (tempPathName, &dummy))  /* formatio.h */
        switch (FileExists (tempPathName, &dummy))  /* formatio.h */
            {
            case 1:  /* file exists */
                break;    /* increment index and try again */
            case 0:  /* file does not exist */
                foundNameToUse = TRUE;
                break;
            case -1: /* too many file handles open */
                errChk (UIETooManyFilesOpen);
                break;
            default: /* should not occur */
                errChk (UIEIOError);
                break;
            }

I'm not sure of the total impact those changes will make, but for now it works
Any thoughts?

Thanks
Gary
0 Kudos
Message 2 of 4
(3,178 Views)

Check the list of cvi libraries that you are linking with. Instead of linking with cvi_lvrt.lib, try linking with cvirt.lib.
Let me know if this fixes things and I'll document this fix in our knowledgebases.

Bilal Durrani
NI
0 Kudos
Message 3 of 4
(3,165 Views)
Bilal:
    Thank you very much, linking with cvir.lib fixed it.

Gary
0 Kudos
Message 4 of 4
(3,161 Views)