キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

Writing a string to binary file

解決済み
解決策を見る

Hello Community

 

I am trying to write to a binary file that is read with Delphi as well as with LabView. While writing strings in the binary file Delphi uses 1 byte at the beginning for the string length and then writes the string. LabView does it differently though. Any Ideas of how can I write a byte array of a string replicating the Delphi format?

 

Thanks in advance

0 件の賞賛
メッセージ1/5
6,033件の閲覧回数
解決策
受理者 AnaZerpa

Hi Ana,

 

switch off the array/string size when writing the string to your binary file (it's an input parameter of the WriteBinaryFile function)!

Then write your own string length indication byte in front of the string (or prepend the length byte to the string data)…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
メッセージ2/5
6,019件の閲覧回数

HI,

You can simply everytime write at fisrt time an octet into binary file, before to write your data(String).

This obligate you to use fonction write to Binary file two time successively.

 

0 件の賞賛
メッセージ3/5
6,009件の閲覧回数

I am in the boat of prepending the length byte to your data before writing to the file.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
メッセージ4/5
5,998件の閲覧回数

So how does Delphi handle strings longer than 255 bytes?

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 件の賞賛
メッセージ5/5
5,975件の閲覧回数