Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated  Rate this Document

Why Does the Set File Size Function Generate Garbage Data When Run on a Real-Time Target?

Primary Software: LabVIEW Run-Time Engine
Primary Software Version: 8.0
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem:
I have a VI (attached file: SetFilePos.vi) that creates a new file and sets the file size using the Set File Size function. When I run this VI in the LabVIEW Development Environment the file is created and contains no data. Unfortunately, when I run the same VI on a Real-Time target the file is filled with garbage data. Why does the file created on the Real-Time target contain data if I didn't insert anything into the file?

Solution:
This is expected. When a file is deleted, the real-time filesystem won't format over the old data. Therefore when you create a file of a certain size, it might have old data in its sector. It is normal to find this old data around. Remember that any time you create a file of a pre-determined size, it is then your responsibilty to keep track of how much of the file you have written to. You must, for example, maintiain a header file telling you how many bytes are valid data.

Related Links:

Attachments:


SetFilePos.vi - SetFilePos.vi


Report Date: 03/02/2007
Last Updated: 03/12/2007
Document ID: 46L718UQ

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit