🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: bit.listserv.authorware
Article #96

How to get binary context of a file(not text context)

#96
From: huangjian
Date: Wed, 12 Mar 2003 07:01
25 lines
1955 bytes
I want to read a file by binary mode. I combined the function
"readchar" of xtras object "fileio" and the system function "Code".The
principle is to get single char and then to change the char into byte
using "code" function, but it seems that the function "code" would
return 0 when it meet the unusual char such as 0x8B.

I wrote the code like this:
------------------------------------------------------------------
object:=NewObject("fileio")
CallObject(object, "openFile", "c:\\test.bin", 1)
Filelength:=CallObject(object, "getLength")
repeat with Counter := 0 to Filelength-1
    SingleChar:=Code(CallObject(object, "readChar"))
    MessageBox(WindowHandle, "Counter is"^Counter^" SingleChar
is"^SingleChar, "Warning", 48)
    PokeByte(inbuffer, Counter, SingleChar)
end repeat
CallObject(object, "closeFile")
DeleteObject(object)
----------------------------------------------------------------------
after I run the code, the MessageBox will show" Counter is x
SingleChar is 0", but current char is 0x8B.

Any help is appreciated! How to get the binary context of a file?
E-mail:huangjiansword@yahoo.com.cn
Technical Details
Message-ID: <a60b3762.0303112301.2792a005@posting.google.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f49cb,b6c1bc871c1ded8e,start
X-Google-Attributes: gidf49cb,public
X-Google-ArrivalTime: 2003-03-11 23:01:43 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mail
From: huangjiansword@yahoo.com.cn (huangjian)
Newsgroups: bit.listserv.authorware
Subject: How to get binary context of a file(not text context)
Date: 11 Mar 2003 23:01:42 -0800
Organization: http://groups.google.com/
Lines: 25
Message-ID: <a60b3762.0303112301.2792a005@posting.google.com>
NNTP-Posting-Host: 210.82.118.33
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1047452502 6661 127.0.0.1 (12 Mar 2003 07:01:42 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: 12 Mar 2003 07:01:42 GMT