LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to disable Range Error during debugging

Hi,
 
I am unable to debug my application as it constantly generates NON FATAL RUN TIME ERROR, and it pauses the execution. The error is generated by strtod call. My string contains just digits, like "250.00" and I do not understand why it is seen as RANGE ERROR. I consulted the help file on strtod and this is what it says:
If the correct value is outside the range of representable values, strtod returns ±HUGE_VAL, according to the sign of the value, and sets errno to ERANGE.
My call seems to be properly converting string "250.00" to a value of 250.0 but it still generates and error.
 
Does anybody know why it's doing this and how to disable this?
Thanks
J.
0 Kudos
Message 1 of 6
(3,768 Views)
Could you post a code snippet, with the relevant declarations?
 
JR
0 Kudos
Message 2 of 6
(3,763 Views)

Here it is:

////////////////////////////////////////////////

char szBuffer[256],*endPtr;

double dFrequency;
dFrequency=strtod(szBuffer,&endPtr);

//////////////////////////////////////////////////

Thanks for your help.

0 Kudos
Message 3 of 6
(3,758 Views)
I am unable to duplicate the error you are having with the code snippet you provided.  Where is the value of szBuffer being set?
 
I modified your test case to the following, the major difference being I initialize szBuffer to 250.00, and it works just fine:
 
#include <ansi_c.h>
#include <string.h>
void main ()

   char szBuffer[] = "250.00";
   char *endPtr;
   double dFrequency; 
 
   dFrequency = strtod(szBuffer,&endPtr);  
}
0 Kudos
Message 4 of 6
(3,744 Views)
Please see attached jpg. My string was "250".
My Debugging Level is standard and I am using CVI 8.5
Thanks
J.
0 Kudos
Message 5 of 6
(3,726 Views)
Hello J,

What happens when you try to run a very simple program such as the one kcoggins posted in message 4?  Do you still get this same error?  If not, can you upload the smallest code snippet that will exhibit this NON-FATAL ERROR?
Best Regards,
Software Engineer
Jett R
0 Kudos
Message 6 of 6
(3,687 Views)