LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a known problem with fgetpos and fsetpos in LabWindows/CVI? v6.0

I'm using fgetpos & fsetpos with LabWindows/CVI v6. The file pointer always ends up 7 bytes too early in the file. (MS Visual studio works fine with the same code) is this a known problem? If so is there a patch available?
0 Kudos
Message 1 of 5
(3,324 Views)
There is not been any problem reported with these functions. Can you post example code that illustrates the problem you are seeing?

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 5
(3,324 Views)
The plot has thickened a bit:
In trying to provide a cut down version of the program to demonstrate the problem I have discovered that it does not occur on a cut down version of the data file.
The full file is 5500k bytes, but the problem occurs on reading just the first 3 lines. A test version of only the first 4 lines works fine.

I'll attach the test code (not the most beautifull) but unfortunately the data file is proprietory so I can't attach that.

Any thoughts would be welcome!
0 Kudos
Message 3 of 5
(3,324 Views)
Well, I didn't find anything wrong with your code. I tried running it on about a dozen files of various sizes, one of which was over 2Megs of text. I couldn't reproduce the problem you are seeing with any of them. I don't really know what else to look for to try and help.

Chris
0 Kudos
Message 4 of 5
(3,324 Views)
I've been doing a bit more digging and discovered that:
The data file I'm interested in , and creates a problem, terminates the lines with just 0x0a (LF).
Whereas the short test file terminates the lines with 0x0d, 0x0a (CR,LF) and is fine.
Now I would have thought in this day and age standard libraries would have been able to handle the dos/unix difference. Apparently not!

An abbreviated file of test data is attached for anyone interested. Run the test program on it and see the fgetpos problem; Remove a few lines; rerun the test program and watch the file position move.

Anyone got any suggestions, short of reformatting all current and future data files?
0 Kudos
Message 5 of 5
(3,324 Views)