printf without '\n'
Newbie simple question:
With a code like this:
.section .data
MSG:
.ascii "Hello\0"
.section .text
.globl _start_start:
pushl %ebp
movl %esp, %ebp
pushl $MSG
call printf
movl %ebp, %esp
popl %ebp
movl $1, %eax
xorl %ebx, %ebx
int $0x80
I compiled it with:
as code.s -o code.o; ld --dynamic-linker /lib/ld-linux.so.2 -lc \
test.o -o test
With that ascii string, nothing is printed but when I use "Hello\n\0" it works fine.
What is the reason for not printing the string if there isn't a '\n' in it?
I something related with the buffered (by lines) IO?
Why with a C program it does not happend.
Thanks in advance.
Hi,
Did you try running the program twice ? the problem is obviously buffered I/O, \n is (supposed) to flush the buffer. how about
push $0x0
call fflush
this should flush all output streams, (iff Null is passed)
Joy
--
Girls are like slugs.... You know they are around for a reason, but you cant imagine what.
-- Calvin