; WriteByte Example ; ----------------- ; WriteByte stores a single byte (0 to 255); only the low ; 8 bits of the number are kept file=WriteFile("demo_bytes.dat") WriteByte file,65 WriteByte file,255 WriteByte file,256 WriteByte file,-1 CloseFile file Print "Wrote 4 bytes - demo_bytes.dat is "+FileSize("demo_bytes.dat")+" bytes" ; Read them back to see the wrap-around file=ReadFile("demo_bytes.dat") a=ReadByte(file) Print " 65 -> "+a+" (the ASCII code for "+Chr$(a)+")" Print " 255 -> "+ReadByte(file)+" (largest value a byte can hold)" Print " 256 -> "+ReadByte(file)+" (wrapped around to 0)" Print " -1 -> "+ReadByte(file)+" (wrapped around to 255)" CloseFile file ; Clean up the demo file DeleteFile "demo_bytes.dat" Print "Deleted demo_bytes.dat" Print "" Print "Press any key to close the example" WaitKey End