While debugging an instrument driver I discovered a scanf/fscanf problem. The following code illustrates the problem.
char *sbuf = {"4.000000e-05"};
short cnt;
double f1 = 4.000000e-5;
double f2 = 20e-6;
cnt = (f1 / 20e-6) - 1; // cnt = 1, right
sscanf (sbuf, "%Lf", &f1);
cnt = (f1 / 20e-6) - 1; // cnt = 0, wrong
I noticed that the if I set sbuf to "4.00000e-5" (1 less zero), then the division works.
I am using LabWindows v6.0
Is this a known issue? and/or is there a workaround for it?