FBInRead
FBinRead [/B[=b ]/F=f ] refNum, objectName
The FBinRead operation reads binary data from the file specified by refNum into the named object.
For simple applications of loading binary data into numeric waves you may find the GBLoadWave operation simpler to implement.
Parameters
refNum is a file reference number from the Open operation used to open the file.
objectName is the name of a numeric variable, string variable, structure, or wave.
Flags
| /B[=b ] | Specifes file byte ordering. | ||||||||||||||
| |||||||||||||||
| /F=f | Controls the number of bytes read and how the bytes are interpreted. | ||||||||||||||
| |||||||||||||||
| /U | Integer formats (/F=1, 2, 3, or 6) are unsigned. If /U is omitted, integers are signed. | ||||||||||||||
Details
If objectName is the name of a string variable then /F does not apply. The number of bytes read is the number of bytes in the string before the FBinRead operation is called. You can use the PadString function to set the size of a string.
The binary format that FBinRead uses for a numeric variable depends on the /F flag. If you omit /F, the native data type of the variable, which is 8-byte double-precision floating point, is used. So, when reading into a real numeric variable, depending on /F, FBinRead reads 1, 2, 4, or 8 bytes from the file, converts those bytes to double-precision floating point if necessary, and stores the resulting value in the variable. When reading into a complex numeric variable, this process is repeated twice, once for the real part and once for the imaginary part.
Reading real waves works like reading real variables except that a real wave has multiple elements each of which is 1, 2, 4, or 8 bytes depending on the wave's data type. For each element of a real wave, FBinRead reads the number of bytes implied by /F or by the wave's native data type, converts those bytes to the wave's data type if necessary, and stores the resulting value in the corresponding wave element. When reading into a complex wave, this process is repeated twice, once for the real part of each element and once for the imaginary part.
Reading structures is different. The /F flag has no effect. FBinReads reads the number of bytes required to fill the structure which depends on the sizes of the individual fields and the fact that Igor uses 2-byte structure alignment. After the bytes are read from the file into the structure, FBinRead byte-swaps the individual fields if you include the /B flag.
The FBinRead operation is not multidimensional aware. See Multidimensional Waves, particularly Analysis on Multidimensional Waves for details.