ex:
args = {...}
file = fs.open(args[1], "r")
a = tobynary(file.readAll())
b = frombinary(a)
file = fs.open("output", "w")
file.write(B)/>
file.close()
Posted 31 March 2013 - 07:27 AM
args = {...}
file = fs.open(args[1], "r")
a = tobynary(file.readAll())
b = frombinary(a)
file = fs.open("output", "w")
file.write(B)/>
file.close()
Posted 31 March 2013 - 07:35 AM
function toBase(str, base) --Encodes @str in @base if not base then return nil end str = tostring(str) local res = "" for i = 1, str:len() do if i == 1 then res = basen(str:byte(i), base) else res = res..":"..basen(str:byte(i), base) end end return res end function fromBase(str, base) --Decodes @str from @base if not base then return nil end str = tostring(str) local bytes = seperate(str, ":") local res = "" for i = 1, #bytes do res = res..(string.char(basen(tonumber(bytes[i], base), 10))) end return res end function toBinary(str) --Encodes @str in binary if not str then return nil end str = tostring(str) return toBase(str, 2) end function fromBinary(str) --Decodes @str from binary if not str then return nil end str = tostring(str) return fromBase(str, 2) en
Posted 31 March 2013 - 01:48 PM
Posted 31 March 2013 - 02:18 PM
0 members, 2 guests, 0 anonymous users