Unable to read certain characters (Program Bug and Problems)

by Jim ⌂ @, Russell, KY, Sunday, November 04, 2012, 02:21 (1844 days ago) @ Andrew360

Andrew,

The read command and readline command are only designed to work with text strings. If you want to read and write special characters then I would recommend code like:

b$ = "testsuite_binary.dat"
print "new file"
openb b$
for t = 0 to 255
writebyte t
next t
close
openb b$
a = 0
while not eof
a+= readbyte()
end while
call n("bindata sum", a, 32640)
print "position to 10 and read"
seek 10
a=0
while not eof
a+= readbyte()
end while
call n("bindata sum from 10", a, 32595)
close
kill b$

Use openb to turn off crlf translation and use readbyte/writebyte to manipulate the file 8 bits at a time. This is in the binary release 0.9.9.14 and after

Jim


Complete thread:

 RSS Feed of thread

powered by my little forum