QB64.org Forum
Active Forums => QB64 Discussion => Topic started by: mcampbe on September 19, 2021, 11:56:54 pm
-
Does anyone know how to do an ansi binary read of a file? From what I can tell I know how to do an ascii binary read of a file by open the file using the Open "example.txt" for Binary as #1 code. As fas as I can tell that is an ascii binary read but I can't seem to do an ansi binary read. Any suggestions?
-
When you open for binary, you read 1 ansi character at a time.
ASCII is 7-bit values, for a max of 128 characters.
ANSI is 8-bit values, for a max of 256 characters.
You almost never see true 7-bit ASCII anymore; you always see ANSI files which people just call ASCII as the first 128 characters are an identical match to the ASCII characters.
QB64 works with 8-bit characters (ANSI) and not any compressed 7-bit ASCII. All you ned to do is simply read a character and you’ll get the 8-bit value back for it.
Where you might be seeing issues is in the codepage your data was encoded in, causing the extended-ascii characters to not display properly, but that’s a different issue from your question completely.