Re: Hexdump - Display TextElements from binary File



> If i read the file in binary mode from beginning or from
> my start pointer i get to my messagebox some readable
> characters until there is no zero value. If my application
> reads a zero byte i get no more results to my messagebox.

That's to be expected. MSGBOX displays all text as 'ASCIIZ' strings,
teminating on a null byte.

What you might want to try is replacing all nulls in your string with a
non-null character before attempting to display that string wiht MSGBOX.

e.g., something like this...

> ' read 200 Bytes from Pointer
> FOR a = 1 TO 200
> GET$ #1, 1 , Char$
> TempStr$ = TempStr$ + CHR$(Char$)
> NEXT a
addthisline:
REPLACE CHR$(0) WITH CHR$(32) IN TempStr$ <<< change all nulls to
space for purposes of displaying

> MSGBOX "Position in File: " + STR$(position) + $CRLF + _
> "Data from File: " + TempStr$

Note the TempStr DOES include the null characters, so if you write it to a
file the NUL will be included and if you have a hex editor of some kind you
will see it.

That is, this limitation is specifically a limitation of MSGBOX ( and is
documented: "Strings displayed by the MSGBOX statement are truncated if they
contain embedded $NUL {CHR$(0)} bytes.")

MCM





.



Relevant Pages

  • Re: A way to email files with if/then possible?
    ... ' escape the strings is real one click affair and you don't ... ' msgbox oFile.Path ... 'nonprinting characters such as tabs, spaces, and line feeds. ...
    (microsoft.public.scripting.vbscript)
  • Re: A way to email files with if/then possible?
    ... ' escape the strings is real one click affair and you don't ... ' msgbox oFile.Path ... 'nonprinting characters such as tabs, spaces, and line feeds. ...
    (microsoft.public.scripting.vbscript)
  • Re: heeeeeeeeeeeeeeeellllllllllllllppppppppppppppppppppp
    ... Why is using char* a bad thing and why using sprintf a bad thing to, ... can be up to MAX_PATH characters). ... LPSTR lpMsgBuf; ... MessageBox(NULL, lpMsgBuf, "GetLastError() for ...
    (microsoft.public.vc.mfc)
  • Re: heeeeeeeeeeeeeeeellllllllllllllppppppppppppppppppppp
    ... can be up to MAX_PATH characters). ... The FIRST thing you do is call GetLastError() and save the result; ... Using NULL as the parent is almost always a mistake (it means your messagebox ... It is always sloppy to compare any boolean result to TRUE or FALSE, ...
    (microsoft.public.vc.mfc)
  • Re: Why R6RS is controversial
    ... the semantics of the language, ... behavior of grapheme-cluster characters under most linguistic ... as the strings grow longer. ... Normalization is hideously complicated, and may require many ...
    (comp.lang.scheme)

Loading