LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing binary data to a file without carriage returns every 512 bytes

Is there a VI for writing binary data to a file without carriage returns being inserted every 512 bytes?
Thanks
0 Kudos
Message 1 of 13
(3,958 Views)
Why you think that there is carriage returns symbol every 512 bytes?
0 Kudos
Message 2 of 13
(3,958 Views)
I looked at the binary file with a hex editor!
0 Kudos
Message 3 of 13
(3,958 Views)
O.K.

The carriage returns symbol inserted by hex editor (only visually), but your binary file is without it.
Check this by reading the file by "Read Binary File" VI.
0 Kudos
Message 4 of 13
(3,958 Views)
Not only visually! After reading the binary file in FORTRAN and deleting the carriage returns and closing the file they were no longer visible in the hex editor. The program could satisfactorily read all of the data array correctly after this action.
0 Kudos
Message 5 of 13
(3,958 Views)
> I looked at the binary file with a hex editor!

Another diagnostic is to drop a string indicator and change it to show
hex. Wire the data going to the file to the string as well. Either
your string already has a CR in it that the diagram added, or there will
not be one put in the file. Binary file I/O adds nothing.

Greg McKaskle
0 Kudos
Message 6 of 13
(3,958 Views)
First what VI do you use that inserts a carriage return every 512 bytes?


LabVIEW, C'est LabVIEW

0 Kudos
Message 7 of 13
(3,958 Views)
Using LabView 6.1 : File IO > Binary > Write_SGL_to_File.VI
Any example programs where it wired so that carriage returns do not get generated would be appreciated.
We have looked at the documentation and have not been able to turn it off.
0 Kudos
Message 8 of 13
(3,958 Views)
Hi Momolxg,

I could be way off on this. I tried to simulate what you've done by
making a for loop that would run a set number of times. For my example I
used 1025. I wired the iteration terminal to a 'Write to SGL File.vi'
outside the loop with indexing enabled. It wrote the SGL data from 0 to
1024 to the file. I then read the file with a 'Read Characters from
File.vi' and searched the output for a carriage return (0D hex). It was
found five times. The reason why was the SGL number it was reading had a
13 (0D hex) in it. Perhaps you're running into a similar problem?

I tried it again, this time using the 'Write to I16 File.vi'. The
carriage return was found five times: the 28th character the first time
then on the 512th character four consecutive time
s after that. I suppose
that makes sense that you'd find a 0D in the numbers at equal spacings if
they're incrementing this way... In this case the carriage returns you're
seeing are actually numbers from your data.

One big difference is that I'm using a set pattern of numbers. This
doesn't appear to be your case. Is there a better way we can duplicate
your problem? It sounds interesting. Again my simulation could be way
off. (I'm also running this on LV60 for Linux so my results could be
different)

- Kevin


In article <5065000000080000002E610000-1031838699000@exchange.ni.com>,
"momolxg" wrote:

> Is there a VI for writing binary data to a file without carriage returns
> being inserted every 512 bytes? Thanks
0 Kudos
Message 9 of 13
(3,958 Views)
Wonderful. I think you have reproduced my problem!
It has nothing to do with your data set. Just try it with random data. I remove the carriage rturns so that I can read my data with a FORTRAN program and when I do so get data that matches what I see in LV.
We have tried to understand from the documentation if it is necessary to have these carriage returns but have not found the means for turning it off. Suggestions welcome!
0 Kudos
Message 10 of 13
(3,958 Views)