Alright, here's something I just came up with.
Does anyone have any sugestions, or a way to make each part simpler & more compact?
'----------------------------------
SuperStrict
Global Bit:Int[] = [%1,%10,%100,%1000,%10000,%100000,%1000000,%10000000]
Global n:Byte = Bit[0] | Bit[1] | Bit[2] | Bit[3] | Bit[4] | Bit[5] | Bit[6] | Bit[7]
Global CBit:Int[8]
Local x:Byte, cln:Byte
Print n
' Opening & Writing a Byte to a File
'-------------------------------------------------
Local file:TStream = OpenFile("binary1.bin")
WriteByte(file, n)
CloseStream file
' Opening & Reading a Byte from a File & Taking apart a Byte
'-------------------------------------------------
file:TStream = OpenFile("binary1.bin")
cln = ReadByte(file)
For x = 0 To 7
CBit[x] = (cln & Bit[x] <> 0)
Print CBit[x]
Next
CloseStream file
Does anyone have any sugestions, or a way to make each part simpler & more compact?
'----------------------------------
SuperStrict
Global Bit:Int[] = [%1,%10,%100,%1000,%10000,%100000,%1000000,%10000000]
Global n:Byte = Bit[0] | Bit[1] | Bit[2] | Bit[3] | Bit[4] | Bit[5] | Bit[6] | Bit[7]
Global CBit:Int[8]
Local x:Byte, cln:Byte
Print n
' Opening & Writing a Byte to a File
'-------------------------------------------------
Local file:TStream = OpenFile("binary1.bin")
WriteByte(file, n)
CloseStream file
' Opening & Reading a Byte from a File & Taking apart a Byte
'-------------------------------------------------
file:TStream = OpenFile("binary1.bin")
cln = ReadByte(file)
For x = 0 To 7
CBit[x] = (cln & Bit[x] <> 0)
Print CBit[x]
Next
CloseStream file