home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / basic / library / gwbasic / bit4bit / bit4bit.bas next >
Encoding:
BASIC Source File  |  1987-07-28  |  1.3 KB  |  20 lines

  1. 10 CLOSE:CLS: PRINT"This program will display any file byte-by-byte and change any specified byte.  If you simply want to look at a file BYTE by BYTE you need not enter a search string or a replace string or a destination filename."
  2. 20 PRINT: PRINT: PRINT: INPUT "Filename to read:" ; F$
  3. 25 PRINT:PRINT:INPUT "Filename to contain new file:";N$
  4. 30 PRINT: INPUT "BYTE to look for:"; B
  5. 40 PRINT:INPUT"BYTE for replacement:";R
  6. 45 CLS: PRINT "Searching for ";CHR$(B) ;" in file "; F$ ; " and replacing with "; CHR$(R) ; " in "; N$
  7. 47 PRINT:PRINT:PRINT "Do you want a slowdown factor?" :PRINT"With a factor of 0 100 records were processed in approxamately 06 seconds.": PRINT"With a factor of 100 records were processed in approxamately 18 seconds."
  8. 48 INPUT "Enter speed factor or <RETURN> for fastest speed:";S
  9. 50 OPEN"R",1,F$ , 1
  10. 60 FIELD 1, 1 AS I$
  11. 65 IF N$ <> "" THEN OPEN "R", 2, N$, 1: FIELD 2, 1 AS S$
  12. 100 FOR X = 1 TO LOF (1): GET 1, X
  13. 110 PRINT X;ASC(I$);I$,;
  14. 120 IF B <> 0 THEN IF I$ = CHR$(B) THEN Z = Z + 1 :PRINT "Replacing with "; CHR$(R) :S$ = CHR$(R) ELSE S$ = I$
  15. 130 IF N$ <> "" THEN PUT 2, X
  16. 135  IF S>0 THEN FOR C = 1 TO S: NEXT C
  17. 140 NEXT
  18. 170 CLOSE
  19. 180 PRINT R;" Charrachters replaced"
  20.