*======================================================== * Converts a number into a binary string *======================================================== Function ToInt LParameter tnValue, tnBytes Local lcString, lnByte lcString = "" For m.lnByte = 1 to m.tnBytes lcString = m.lcString + Chr(m.tnValue%256) tnValue = Int(m.tnValue/256) Endfor Return m.lcStringuse it like this:
STRTOFILE( ToInt(0,4), "file name") && write binary 0 STRTOFILE( ToInt(1,4), "file name") && write binary 1> The value can either be 1 or 0. The value within the file comes out as " ",
LParameter tcString Local lnPos, lnChar, lnCol, lnRow, lcascii lnCol = 0 lnRow = 0 lcascii = "" For lnPos = 1 To Len(tcString) If lnCol%16 = 0 If lnPos > 1 ?? " " + lcascii Endif ? Transform(lnRow,"@0")+" : " lnRow = lnRow+16 lcascii = "" Endif lnCol = lnCol + 1 lnChar = Asc(SubStr(tcString,lnPos,1)) ?? RighT(Transform(lnChar,"@0"),2)+" " if lnchar >= 32 lcascii = lcascii + chr(lnchar) else lcascii = lcascii + "." endif Endfor ?? space((16-len(lcascii))*3)+" " + lcasciiwhich I call like this:
HexView(FILETOSTR("file name"))