If I understand correctlly, you have a file like this:
********
1.23
2.34
3.45
********
And now you want to transfer it, using a serial connection? Or TCP/IP? Or do
you simply want an array of numbers?
This is important. A ascii string can be transmissioned as it is. So the
'transmission' part is the key question here.
Also, what do you consider a binary? Reading your question, I think you mean
a string, with binary data, relating to the ascii data. So you'll end up
with just another string. Do you need to binarise it for compression?
TCP/IP performs a hardware compression, so converting a string to a binary
string won't do very much.
Anyway, building a binary string goes like this:
Make a while loop, so that you
get each number one by one.
Use the Flatten To Sting function to get binary data.
To reverse:
Get bytes 0Xnr of bytes to 1Xnumber of bytes.
Use Unflatten From String to convert it to a number.
Get bytes 1Xnr of bytes to 2X number of bytes.
Etc (use a for loop, or a while loop).
Depending on the data format, you might not even get less data. (A dbl has 8
bytes of data. So if 1.23 is a dbl, you'll end up with 8 bytes {3FF3 AE14
7AE1 47AE, in hex view}instead of 4 {1.23}!).
Regards,
Wiebe.
"Ridge"
wrote in message
news:5065000000050000007C910000-1027480788000@exchange.ni.com...
> I am a little unsure, here is the total problem. I have to convert an
> ascii data file to binary for transmission, then once at the
> destination, it needs to be converted back to ascii for analysis. I
> have been looking at using the conversion vi converting ascii to
> binary but am unsure of how to save this and what format is required.
> I literally am bamboozled by it all and am getting ve
ry confused. Can
> you give any suggestions about what to do.
> Thanks