Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Basic Powerbasic > Re: Hexdump - ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 4 Topic 173 of 276
Post > Topic >>

Re: Hexdump - Display TextElements from binary File

by "Michael Mattias" <michael.mattias@[EMAIL PROTECTED] > Jan 16, 2006 at 05:10 PM

> 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
do***ented: "Strings displayed by the MSGBOX statement are truncated if
they
contain embedded $NUL {CHR$(0)} bytes.")

MCM
 




 4 Posts in Topic:
Hexdump - Display TextElements from binary File
Alen Hopek <alen.hopek  2006-01-16 18:54:46 
Re: Hexdump - Display TextElements from binary File
"Michael Mattias&quo  2006-01-16 17:10:01 
Re: Hexdump - Display TextElements from binary File
Peter Manders <news@[E  2006-01-16 21:19:26 
Re: Hexdump - Display TextElements from binary File
"Michael Mattias&quo  2006-01-16 21:12:40 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 20:40:03 CDT 2008.