ChipMaster's bwBASIC This also includes history going back to v2.10. *WARN* some binary files might have been corrupted by CRLF.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

29 lines
1023 B

  1. 10 'Test / Demonstrate the use of the BINARY mode files.
  2. : 'Contributed by ChipMaster
  3. : 'NOTE: OPTION VERSION "HAARDT" must be run befor this loads or you
  4. : ' get syntax and or illegal function call errors.
  5. 20 OPTION VERSION "HAARDT" : DEFINT A-Z : CLOSE : 'JIC
  6. 99 '*** Test wries, especially CHR$(0) ***
  7. 100 OPEN "O", #1, "TEST.DAT" : CLOSE #1 : ' ZAP file
  8. 110 OPEN "B", #1, "TEST.DAT"
  9. 120 M1$="" : FOR X= 0 TO 127 : M1$=M1$+CHR$(X) : NEXT
  10. 130 M2$="" : FOR X=128 TO 255 : M2$=M2$+CHR$(X) : NEXT
  11. 140 PUT #1, 1, M1$, M2$
  12. 199 '*** now rewind, reread ***
  13. 200 T1$ = STRING$(128, " ")
  14. 210 T2$ = T1$
  15. 220 GET #1, 1, T1$, T2$
  16. 230 CLOSE #1
  17. 239 '*** compare & spill results ***
  18. 240 IF T1$=M1$ AND T2$=M2$ THEN 270
  19. 250 PRINT "FAIL"
  20. 260 END
  21. 270 PRINT "Worked"
  22. 280 PRINT MID$(T1$, 34, 95)
  23. 290 PRINT "Press [ENTER] to view file";: LINE INPUT X$
  24. 300 ' "hexdump" is a *NIX tool. Substitute your hex deump tool of choice.
  25. 310 SHELL "hexdump -C TEST.DAT | less"