Click to See Complete Forum and Search --> : read() syscall, reading an integer


phyte
08-06-2003, 05:36 PM
Hi I have just started to learn assembly in linux and I have a question.

Is there any way to have the read() syscall, read an integer into memory instead of reading ASCII data types?

For example:
mov eax, 0x3
mov ebx, 0x0
lea ecx, [esp+0x4]
mov edx, 0x4
int 0x80

seems to read ASCII and i process this data in arithmatic later on....

Is there a way to do an atoi(), modification on input data.? Or an alternative to read()? like read_integer() or something.

Thanks a lot for your help, and its good to be back :)

-phyte

Stuka
08-06-2003, 05:50 PM
If you get an ASCII digit, you can AND it with 0x0F to get the integer equivalent. If you have a long string of digits, you'd have to convert it. I did the reverse in an ASM program for school (took an int and displayed it on screen), but that was using the DOS interrupts.