Hi all,
I am trying to find the most efficient way to convert data whether it be text or image data into base 2 binary. However the methods I have research don't seem to be very efficient and was hoping for another method or function to use.
current solution:
chartonum(data)
baseconvert(data,10,2)
and loop through each char add padding etc.
What would be perfect is the base64encode function in livecode but for base2. Any help with this would be great thank you all.
Most efficient way to convert data to binary/base2
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Most efficient way to convert data to binary/base2
Hi.
Does "binaryEncode" do what you need?
Craig Newman
Does "binaryEncode" do what you need?
Craig Newman
Re: Most efficient way to convert data to binary/base2
I'm not sure binaryencode() works that way.
From the dictionary example: charToNum(binaryEncode("B*","01111111")) -- returns 127
But how do you do the reverse of this? To get the ASCII/number or char into binary/base2 using this function.
Still looking into it. Maybe someone can shed some more light on it.
From the dictionary example: charToNum(binaryEncode("B*","01111111")) -- returns 127
But how do you do the reverse of this? To get the ASCII/number or char into binary/base2 using this function.
Still looking into it. Maybe someone can shed some more light on it.
Re: Most efficient way to convert data to binary/base2
Ah.
Now look up the "baseConvert" function.
Craig
Now look up the "baseConvert" function.
Craig