From: glburt@comcast.net
To: linux-assembly@vger.kernel.org
Subject: redirection
Date: Wed, 01 Mar 2006 13:37:40 +0000 [thread overview]
Message-ID: <030120061337.10844.4405A3A4000D752C00002A5C22073000339B9D9A0D0409@comcast.net> (raw)
I have the following program:
SECTION .data ; data section
msg1: db "Hello World -- 1",10,0 ; the string to print, 10=cr
msg: db "Hello World",10 ; the string to print, 10=cr
len: equ $-msg ; "$" means "here"
; len is a value, not an address
SECTION .text ; code section
global main ; make label available to linker
extern printf
main: ; standard gcc entry point
mov edx,len ; arg3, length of string to print
mov ecx,msg ; arg2, pointer to string
mov ebx,1 ; arg1, where to write, screen
mov eax,4 ; write command to int 80 hex
int 0x80 ; interrupt 80 hex, call kernel
push msg1
call printf
add esp, 4
mov ebx,0 ; exit code, 0=normal
mov eax,1 ; exit command to kernel
int 0x80 ; interrupt 80 hex, call kernel
When I assembled/linked it, I used:
nasm -f elf burtp1.asm
gcc burtp1.o
when i ran it, I got two lines of output.:
[burt@linux2 ~]$ ./a.out
Hello World
Hello World -- 1
When I redirected it, I got:
[burt@linux2 ~]$ ./a.out > foo
[burt@linux2 ~]$ cat foo
Hello World
Why was the output from using printf not redirected?
next reply other threads:[~2006-03-01 13:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-01 13:37 glburt [this message]
2006-03-01 14:48 ` redirection Marcin Kościelnicki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=030120061337.10844.4405A3A4000D752C00002A5C22073000339B9D9A0D0409@comcast.net \
--to=glburt@comcast.net \
--cc=linux-assembly@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).