LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing string to binary file without string Pascal style string length prefix

I'm working on creating a binary file (little-endian) that will be read by other programs than LabVIEW.  It simply starts off with a four character string 'iiii'.  LabVIEW flattens the string and writes string length as prefix before writing the actual string:

'iiii' binary file: 00 00 00 04 69 69 69 69

I'd like to simply write:

'iiii' binary file: 69 69 69 69

The documentation talks of converting each character to decimal then to hexadecimal, then finally writing each char of hex string.  I have not been successful in doing this.  Please let me know if there's a clean way of writing strings to binary file without the Pascal string length prefix.  Thanks!

 
0 Kudos
Message 1 of 5
(4,373 Views)
It doesn't seem to me that you have to do any conversion. 69 is the ascii code for a lower-case "I" so simply writing the string to the file will give you four consecutive hex values of 69. Remember that every thing is binary - we humans just build computers that interpret a certain arbitrary set of hexidecimal values as "text".

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 5
(4,365 Views)
1234
Hai,

By conversion did you mean something like this....

This will give you array of 69's

With regards,
JK
(Certified LabVIEW Developer)
Give Kudos for Good Answers, and Mark it a solution if your problem is solved.
0 Kudos
Message 3 of 5
(4,359 Views)
Hi massybird,
connect a false constant to the "write array or string size", then you write only the "real" data.
 
 
Mike


Message Edited by MikeS81 on 07-23-2008 07:17 AM
0 Kudos
Message 4 of 5
(4,357 Views)
Thank you to all who answered so quickly.  I just started using LabVIEW last Friday, so I'm still getting familiar with all the options the graphical components provide.  MikeS81, that's exactly what I needed.
0 Kudos
Message 5 of 5
(4,343 Views)