The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Astro on August 06, 2009, 12:27:54 AM

Title: Output Non-Zero Terminated String
Post by: Astro on August 06, 2009, 12:27:54 AM
Hi,

Maybe a bit of an odd one, but anyway...

How can I print a NON zero-terminated string? In the first byte of my string I have 00 and it of course StdOut thinks it hit the zero terminator and so prints nothing.  ::)  Not useful for my purpose.

I'm struggling to find how to print an arbitrary, non-zero terminated string.

Best regards,
Astro.
Title: Re: Output Non-Zero Terminated String
Post by: dedndave on August 06, 2009, 12:33:54 AM

        .DATA

AString db 0,'Some String'

        .DATA?

hStdOut dd ?
RdWrCnt dd ?

        .CODE

        INVOKE  GetStdHandle,
                STANDARD_OUTPUT_HANDLE
        mov     hStdOut,eax

        INVOKE  WriteFile,
                hStdOut,
                ADDR AString,
                SIZEOF AString,
                ADDR RdWrCnt,
                NULL

Title: Re: Output Non-Zero Terminated String
Post by: Astro on August 06, 2009, 01:00:47 AM
Ahhh! I saw that earlier and wondered.

Thanks!

Best regards,
Astro.
Title: Re: Output Non-Zero Terminated String
Post by: dedndave on August 06, 2009, 04:59:04 AM
btw - the null should appear as a space (white-space character)
255 is also supposed to be a white-space, but some video cards put a centered dot there
i think windows manages character maps, though - so who knows
Title: Re: Output Non-Zero Terminated String
Post by: hutch-- on August 06, 2009, 07:38:49 AM
With Windows you check the font used in CHARMAP iof you have it installed, otherwise pinch it from win2000.