these are BIN/TXT and TXT/BIN conversion programs for Windows.
Bin/Txt converter:
Code: Select all
in = "test.bin"
out = "test.txt"
d = #.readbytes(in)
s = #.size(d,1)
b = #.array(s*2)
> i, 1..s
x = #.array(#.str(d[i],"x2"))
b[i*2-1] = x[1]
b[i*2] = x[3]
<
#.writebytes(out,b)
#.output("Ok")
Code: Select all
in = "test.txt"
out = "test.bin"
t = #.readtext(in,"ascii")
s = #.size(t)
b = #.array(s/2)
> i, 1..s/2
b[i] = #.val(#.mid(t,i*2-1,2)+"h")
<
#.writebytes(out,b)
? (i-1)*2=s, #.output("Ok")