LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

ini file handle needs to be closed when done?

So I'm a wonderin' -

 

Is the handle used with the ini file functions a real Win32 handle or just something NI is calling a handle?  Does it need to be closed with CloseHandle (hIniFile); ?

 

Why can't we use in-line comments in an ini file?       e.g.       tag = value    ; value is important

Is this a win32 constraint?

 

Menchar

0 Kudos
Message 1 of 4
(3,410 Views)

Menchar,

 

The handles used by inifile.fp are not windows handles. They're just memory blocks allocated inside inifile.c. To dispose them, call the Ini_Dispose function. (By the way, like most .fp files in the toolslib folder, this is an open-source utility. You can see what all the functions do by browsing C:\Program Files\National Instruments\CVIxx\toolslib\toolbox\inifile.c)

 

There isn't very good support for comments in inifile.fp. You still can't create your own comments programmatically. But starting with CVI 8.5, it should at least preserve any existing comments that were already in the .ini file.

 

Luis

0 Kudos
Message 2 of 4
(3,387 Views)

Correction:

 

I need to qualify what I said about the comments. I said that starting with CVI 8.5, comments are preserved. But that's only the case for comments in their own lines (with a leading ; ). A colleague just pointed out to me that you were asking about inline comments. There's no support for those, and they will probably be considered part of the value.

 

Luis

Message Edited by LuisG on 01-23-2009 12:06 PM
0 Kudos
Message 3 of 4
(3,376 Views)

Thanks Luis.

 

It's sortof confusing for NI to use the term "handle" with the ini file, 'cause most any programmer familiar with win32 is going to think it's a Win32 handle, and the matter is further confused by the fact that you can declare the value as HANDLE (from windows.h or one of its includes) and it works !  That is, until you try to CloseHandle() it and then it blows up 😞

 

I'm not certain that the windows profile API supports in-line comments in ini files though if it does it would be nice to support it in the ini file FP.

 

I had thought that the source might be somewhere but didn't feel like looking for it 🙂

Message Edited by menchar on 01-23-2009 02:16 PM
0 Kudos
Message 4 of 4
(3,357 Views)