That's my main (). When I get the error I have done very few operations.
int main (int argc, char *argv[])
{
int x = 0, nc;
char a[256];
SYSTEMTIME dh;
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
// Decode the name of the program
strcpy (pgm, argv[0]);
if ((nc = FindPattern (pgm, 0, -1, ".", 0, 0)) > 0) pgm[nc] = 0;
//-----------------------------------------------------
// Preliminary checks
//-----------------------------------------------------
SetBreakOnLibraryErrors (0);
// AvvioPgm () functions check for presence of necessary files, read configuration files and open serial port
// It returns 0 in case all is OK, 1 if not
if (AvvioPgm (x)) exit (EXIT_FAILURE); //<<== Here I catch the
error
// Load main panel
if ((mainH = CaricaPannello (0, UIR, Main)) < 0)
return -1;
if (BeingDebuggedByCVI ()) {
// Customizations in case of execution in the IDE
}
// Other customisations
SetPanelAttribute (mainH, ATTR_WINDOW_ZOOM, VAL_MAXIMIZE);
//-----------------------------------------------------
// Start user interface
//-----------------------------------------------------
RunUserInterface ();
//-----------------------------------------------------
// Program end
//-----------------------------------------------------
arrtot ();
DiscardPanel (mainH);
// Free dynamic memory
if (rawDb) free (rawDb);
if (rawSp) free (rawSp);
return 0;
}