system_read() question
Say I do something like this:
mov eax, 3 ;setup for system read()
mov ebx, 0 ;receive input from stdin (keyboard)
mov ecx, foo_input ;input will act as a storage place for data
int 0x80 ;syscall interruptDoes anything get added to the storage array (foo_input) after my input. Like the null or CR character?
Thanks,
dave
Supposing that you're using buffered input (default), it will add a line feed character (0x0A) to the end of the string.
Jason
Quoted 13 lines · dAvId KeDrOsKy
Say I do something like this:
mov eax, 3 ;setup for system read() mov ebx, 0 ;receive input from stdin (keyboard) mov ecx, foo_input ;input will act as a storage place for data int 0x80 ;syscall interruptDoes anything get added to the storage array (
foo_input) after my input. Like the null or CR character?Thanks,
dave
Jason Borden am Montag, 3. Februar 2003 22:46:
Quoted 2 lines
Supposing that you're using buffered input (default), it will add a line feed character (
0x0A) to the end of the string.
certainly not!
Quoted 22 lines
Jason
Quoted 7 lines · dAvId KeDrOsKy
Say I do something like this:
mov eax, 3 ;setup for system read() mov ebx, 0 ;receive input from stdin (keyboard) mov ecx, foo_input ;input will act as a storage place for data int 0x80 ;syscall interruptQuoted 6 lines
Does anything get added to the storage array (
foo_input) after my input. Like the null or CR character?Thanks,
dave
-
To unsubscribe from this list: send the line "unsubscribe linux-assembly" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Linux,Assembly,Forth: http://www.lxhp.in-berlin.de/index-lx.shtml en/de pse, reply to << lxhp -at- lxhp -dot- in-berlin -dot- de >>
Quoted 7 lines · hpr
Jason Borden am Montag, 3. Februar 2003 22:46:
Quoted 2 lines
Supposing that you're using buffered input (default), it will add a line feed character (
0x0A) to the end of the string.certainly not!
Quoted 1 line
Jason
I can't tell if you're agreeing with me or not, but here's proof of concept in nasm format:
section .data
hex db "0123456789ABCDEF"
section .text
global _start
_start:
mov eax, 3
mov ebx, 0
mov ecx, foo_input
mov edx, 0x40
int 0x80
mov ecx, eax
mov edi, foo_output
mov esi, foo_input
mov eax, 0
loop_output:
lodsb
mov ebx, eax
and al, 0xF0
shr al, 4
mov edx, eax
add edx, hex
mov al, byte[edx]
stosb
mov eax, ebx
and al, 0x0F
mov edx, eax
add edx, hex
mov al, byte[edx]
stosb
mov al, 0x20
stosb
loop loop_output
mov al, 0x0A
stosb
mov eax, 4
mov ebx, 1
mov ecx, foo_output
mov edx, edi
sub edx, foo_output
int 0x80
mov eax, 1
xor ebx, ebx
int 0x80
section .bss
foo_input resb 0x40 foo_output resb 0x101
Quoted 11 lines · hpr
Quoted 7 lines
Jason Borden am Montag, 3. Februar 2003 22:46:
Quoted 2 lines
Supposing that you're using buffered input (default), it will add a line feed character (
0x0A) to the end of the string.certainly not!
Quoted 1 line
Jason
I can't tell if you're agreeing with me or not, but here's proof of concept in nasm format:
Yes, and when I try out your program:
$ echo -n foo | ./a.out 66 6F 6F
... we see that there is no line feed added.
The reality is not that line feeds are *added*. The reality is that line feeds are not *removed*. In exactly the same way that spaces, periods, and instances of the letter Q are not removed.
b
Quoted 8 lines · Brian Raiter
Quoted 2 lines
I can't tell if you're agreeing with me or not, but here's proof of concept in nasm format:
Yes, and when I try out your program:
$ echo -n foo | ./a.out 66 6F 6F
Quoted 7 lines
... we see that there is no line feed added.
The reality is not that line feeds are *added*. The reality is that line feeds are not *removed*. In exactly the same way that spaces, periods, and instances of the letter Q are not removed.
b
OK, forgive me for even trying to help your sorry butt
Quoted 1 line
OK, forgive me for even trying to help your sorry butt
Sorry if you took offense at my post. I was just trying to explain what I thought was the source of your confusion. But note that my sorry butt was not the one that was asking for help originally.
b
Jason Borden am Dienstag, 4. Februar 2003 17:09:
Quoted 11 lines · hpr
Quoted 7 lines
Jason Borden am Montag, 3. Februar 2003 22:46:
Quoted 2 lines
Supposing that you're using buffered input (default), it will add a line feed character (
0x0A) to the end of the string.certainly not!
Quoted 1 line
Jason
I can't tell if you're agreeing
again, certainly not.
Quoted 1 line
with me or not, but here's proof of concept in nasm format:
conveniently adjusted blindness or, selective recognition is not a matter of 'agreement'. plain statement is no 'proof'. unverified nonsense, how often repeated, remains nonsense and provides no help at all.
I'd suggest verifying yourself before insisting on 'teaching'.
best,
hp
Signature · 2 lines
Linux,Assembly,Forth: http://www.lxhp.in-berlin.de/index-lx.shtml en/de pse, reply to << lx -at- lxhp -dot- in-berlin -dot- de >>
Quoted 9 lines
Say I do something like this:
mov eax, 3 ;setup for system read() mov ebx, 0 ;receive input from stdin (keyboard) mov ecx, foo_input ;input will act as a storage place for data int 0x80 ;syscall interruptDoes anything get added to the storage array (
foo_input) after my input. Like the null or CR character?
We don't know the value of edx, so who know what will happen?
You need to set edx to the size of your input buffer (foo_input).
b