LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting Microsoft Visual C++ Floats stored in Hex to Floats in LWCVI under Visual C/C++ Compatibility

Does anyone know how to convert MS Visual C++ float values, stored in an ascii file format, to a valid float value in LW CVI?
0 Kudos
Message 1 of 2
(2,521 Views)
If the data is stored in an ASCII text file, it doesn't matter where they came from (e.g. VC++). Just use standard ANSI C functions to read them in. For example:

FILE *myfile;
float myFloat;
if ((myfile = fopen ("mydata.txt", "r")) == NULL)
printf("Error opening file.\n");
else
{
while (fscanf (myfile, "%f", &myFloat) >0)
{
printf("%f\n", myFloat);
}
fclose(myfile);
}
0 Kudos
Message 2 of 2
(2,518 Views)