From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
02-01-2010 12:17 PM
Solved! Go to Solution.
02-01-2010 12:43 PM - edited 02-01-2010 12:49 PM
Hi dj,
typecast all those values to either string or array of U8, then write the file.
A binary file is just a collection of bytes, so you can write just bytes...
Edit:
You don't need to typecast, you can wire all those values directly to WriteBinaryFile functions. This function is polymorphic...
Dis-/Advantages:
- using typecast and build string you can limit the number of file accesses, working in memory is usually faster than disk access
- using polymorphism of WriteBinaryFile you can limit memory needs of your program with the disadvantage of having a lot more file accesses
Choose what best fits your needs...
02-02-2010 10:44 AM
You don't need to typecast, you can wire all those values directly to WriteBinaryFile functions. This function is polymorphic...
Yea, if you just write the raw data to binary, as long as you read it out as the same adapter you will be able to interface with this file from any programming language.
02-02-2010 12:36 PM
At first I attempted to save the file from a cluster of the various data objects. However, it did'nt work and I then sent the question to the forum. Gerd's comment that a binary file is a collection of bytes got me to thinking to append the binary write functions. Attached is a screen shot of the code, which is now working for my application. The purpose of the four write functions that has the constant is used as "dummy" bytes in an effor to be compatible with the other system. Although I have not tryied the typecast method, perhaps there is a more elegant way to this other that what is shown in the attached.
Thank you for your responses.
Dave
02-02-2010 12:37 PM
02-03-2010 12:27 PM
Dave
Check out this code. You can write any cluster directly into the write to binary file VI. Then use cluster constant of the same type (or the same cluster)to read the binary data out as the same data type.
-Hunter
02-24-2010 09:59 AM
Hi Hueter,
Sorry it took so long to respond. I was sidetracked on other projects. I am not able to use the cluster method, which is similar to the first attempt. I had to go back to using the code shown on Feb 2nd. By the way the code shown on the 2nd does not have the Byte Order constant connected to all the file write functions as they should have been.
Thanks,
Dave