LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

error

Im getting a error this error below  FATAL RUN-TIME ERROR:   "CIF_EVENT_LOG.c", line 112, col 30, thread id 0x00001B10:   The program has caused a 'General Protection' fault at 001B:68561DF7.

 

why is that?

 

 

                 GetCtrlVal (panelHandle, CIF_PANEL_SCRIPTNAMESTRING, scriptName);
                 fpTextFile = fopen (scriptName, "r");
                 if (fpTextFile == NULL)
                 {
                      sprintf(statusMsg, "Error opening file %s", scriptName);
                      MessagePopup ("File Open Error", statusMsg);
                 }
                 else
                 {
                        while (fgets (sScriptLine, 256, fpTextFile) != NULL)
                        {
                                   iScriptLine=atoi(sScriptLine);
                                  if(iScriptLine == 3309)
                                  {
                                      MessagePopup("NEW EVENT", "--------------");
                                  }
                                  else
                                  {
                                      MessagePopup("WORD DISPLAY",(const char *)iScriptLine);********************* this is the error
                                  }
                                
                        }
                       fclose(fpTextFile);
                         
                 }
                  break;
    }


    return 0;
}
 

0 Kudos
Message 1 of 3
(3,258 Views)

What are you expecting to obtain by casting some (integer?) variable to a const char? You are very likely to get this type of errors in this case. Why not directly passing sScriptLine to MessagePopup? Alternatively, to examine the value of iScriptLine you will need to format it into a string to pass then to MessagePopup function.

 

(casting the address of iScriptLine to a char will result in obtaining the character whose value is stored in iScriptLine, but you will obtain meaningless results with your 3309 value. As an example, if iScriptLine == 65 then MessagePopup("WORD DISPLAY",(const char *)&iScriptLine); will result in a popup window with "A" as the message body)



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 2 of 3
(3,225 Views)

Im recieving a application error when im trying to run my gui.exe on another computer that does have labwindows cvi, 0xc00000005.  

at first its said add the cvirte.dll, the  after i added the dll, intialization error. do 

0 Kudos
Message 3 of 3
(3,190 Views)