Search code examples
binaryrtflabview

LabVIEW Binary File from Database to .rtf in .Net control


I have one vi where I save a .rtf file to a database like so:

Upload .rtf

Later, I get the file from the database and save it as an .rtf before I open it with another vi (rtf viewer.vi):

.rtf save

However, Although rtf viewer.vi will work with files that are not uploaded to the database, it cannot read these files. Opening a file in Notepad++ gets me the following:

Ā؀萀ĀĀ ᄠĀ
�{\rtf1\ansi\ansicpg1252\deff0\deflang1033\deflangfe1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Calibri;}{\f1\froman\fprq2\fcharset2 Symbol;}} \viewkind4\uc1\pard\sa160\sl252\slmult1\b\f0\fs22 Known Issues:\par \pard\fi-360\li720\sa160\sl252\slmult1\b0\f1\'b7\tab\f0 VI Displays no error when "Print." is Selected with no printer attached\par \f1\'b7\tab\f0 Arduino driver does not currently initialize with startup\par \pard\sa160\sl252\slmult1\b Improvement Points:\par \pard\fi-360\li720\sa160\sl252\slmult1\b0\f1\'b7\tab\f0 Time numeric constants are listed in numeric format time format\par \f1\'b7\tab\f0 Does not support test steps longer than 50 days\b\par \pard\sa160\sl252\slmult1 Change Log:\par \pard\fi-360\li720\sa160\sl252\slmult1\b0\f1\'b7\tab\f0 [Date] Fixed Issue with Results Display - JLS\par \f1\'b7\tab\f0 [Date] Added Arduino Control -JLS\par }

The file does save, however, it's not able to be read by my viewer vi


Edit:

The issue is on the download side when writing to the binary file, I've been able to eliminate it by formatting the variant as a string before writing. However, that's added a '/00' char after every byte which I eliminate from the string after writing:

Working Code


Solution

  • The Real problem here is that the LabVIEW string uploads to the Database as an array of I 32 values so each char is padded. As a result, we need to convert the string into a u8 array for the LabVIEW database upload vi to work correctly as such:

    enter image description here