Why are there Four Extra Bytes in the Beginning of my Binary File?Primary Software: LabVIEW Development Systems>>LabVIEW Base PackagePrimary Software Version: 7.0 Primary Software Fixed Version: N/A Secondary Software: N/A
Problem: I am using the LabVIEW Write to Binary File VI. When viewing this file in a hex editor, there are four extra bytes of information at the beginning of the file. Why is this? Solution: The first four bytes in the binary file represent how many elements of data are in the binary file. For example, if you write an array of 10 integers in I32 format to a binary file, the first four bytes will have the value 10. This is to tell the program reading the file that there are 10 elements in the file. In the picture below, we are writing an array of 10 integers (I32 format) to a binary file. 00 00 00 0a represents the number 10 in hex, telling us that there are 10 integers in this file. The next four bytes represent the first number written to the file. So the number 00 00 00 01 represents the number 1 in hex, tellling us the first integer written to the file is a 1. The rest of the data, integers 2 through 10 follow.Related Links: LabVIEW 8.6 Help: Write to Binary File Function LabVIEW 8.6 Help: Writing to Binary Files Attachments:
Report Date: 01/20/2007 Last Updated: 07/10/2009 Document ID: 45JDON4G |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
