home *** CD-ROM | disk | FTP | other *** search
- /*
- Listing 21.10 Hexdump()
- Author: Joe Booth
- Excerpted from "Clipper 5: A Developer's Guide"
- Copyright (c) 1991 M&T Books
- 501 Galveston Drive
- Redwood City, CA 94063.4728 415) 366-3600
- */
-
- //───── must compile with the /N option!
-
- #define BUF_SIZE 200
-
- function hexdump(cFilename)
- LOCAL fh := Fopen(cFilename)
- LOCAL buf:= space(BUF_SIZE),spot,jj,tt
- if fh > -1
- while Fread(fh,@buf,BUF_SIZE) = BUF_SIZE
- for jj=1 to 10
- ?
- for tt= 1 to 20
- spot := (jj-1) * 20 + tt
- ?? dec2hex(asc(substr(buf,spot,1)))+" "
- next
- next
- enddo
- jj :=0
- ?
- while !empty(buf)
- jj ++
- ?? dec2hex(asc(substr(buf,1,1)))+" "
- buf := substr(buf,2,len(buf))
- if jj=20
- jj=0
- ?
- endif
- enddo
- endif
- return NIL
-
- // end of file CHP2110.PRG
-