Console ASCII interpretation

Warner Losh imp at bsdimp.com
Mon May 16 18:19:09 GMT 2005


From: alexander <arundel at h3c.de>
Subject: Console ASCII interpretation
Date: Mon, 16 May 2005 19:11:44 +0200

> Hi there.
> 
> I'm using syscall number 4 write() to output data to stdout using x86
> assembly. When I try to output the following DWORD: 0x00003532 I get
> the following output under Eterm and xterm:  "25". Which is exactly
> what I want.
> 
> However when I do the very same under the console (using bash or sh.
> It doesn't matter) I get this output: "25  ".
> 
> I looked up the ASCII value for 00h and it says NUL. Doesn't that mean
> that there shouldn't be any output at all?

No.  It means NUL.  When writing with write(2), you are telling the
system to output 4 bytes.  How different terminal emulation programs
react is up to them (since xterm and the console are implemented by
different sets of code).

Warner


More information about the freebsd-hackers mailing list