06-28-2018 05:39 PM
Is there a way to retrieve the error string associated with the functions from the 'Function Tree, Reading/Writing .ini–Style Files Control', such as GetGeneralErrorString{} does for the other LabWindow's libraries?
Example, the function Ini_ReadFromFile() can return an error that is -1 to -999 from userint.h or -50000 to -5999 from toolbox.h. Does GetGeneralErrorString translate these to a string or some other function call that may be similar?
Thanks
Solved! Go to Solution.
06-29-2018 01:19 AM
yes, you can use GetGeneralErrorString ( ini_status )
07-02-2018 11:05 AM
Thanks for the reply. It seems GetGeneralErrorString will retrieve an error message but not the correct one relating to .ini style function calls. Take for example 'MakePathname'. When I put in a path name that is over 260 chars I should be getting back an error message something relating to 'Resulting pathname longer than 260 chars.' as stated in the LabWindows/CVI help documentation. Instead GetGeneralErrorString returns a string that says 'The system Font could not be loaded'.
07-02-2018 11:25 AM
hm, I would assume that this is because the Utility library (MakePathname) is not in the list of supported libraries
07-02-2018 04:02 PM
So my original question still stands.
07-02-2018 04:35 PM
But how is MakePathname related to IniFile instrument? The first one pertains to the Utility Library and has its own error codes list, independent from IniFile instrument. And as Wolfgang already mentioned, the Utility library is not covered by GetGeneralErrorString.
07-02-2018 04:49 PM
So there is no way to get an error string from the returned status of the function MakePathname()?
Yea sorry I got tripped up including .ini file stuff.
07-03-2018 12:11 PM
You can write your own function for returning the correct error string for the function; just as an example, I have developed this one:
char * CVIFUNC ET_GetULibFileIOErrMsg (int error)
// Descriptive messages for errors in File Utilities class in Utility Library
{
switch (error) {
case 0: return "Success";
case -1: return "One of the path component not found";
case -2: return "Resulting pathname longer than 260 chars";
case -3: return "General I/O error occurred";
case -4: return "Insufficient memory to complete operation";
case -5: return "Invalid path";
case -6: return "Access denied";
case -7: return "Specified path is a directory, not a file";
case -8: return "Disk is full";
case -9: return "New file already exists";
default: return "Unknown error";
}
return NULL;
}
The Utility library is a complicated beast that covers a lot of different areas; the majority of functions return no error information, while others have error codes partially overlapping; for this realson, it is not possible to have a single function that covers all items in the library. The library itself only offers a similar facility for functions related to multithreading (CmtGetErrorMessage).