I am learning assembly and there were different file descriptors used for reading user input.
For reading keyboard entry, I was expecting file descriptor 0 (stdin), but came across this article where file descriptor 2 (stderr) was used.
;Read and store the user input
mov eax, 3
mov ebx, 2
mov ecx, num
mov edx, 5 ;5 bytes (numeric, 1 for sign) of that information
int 80h
However, I've commonly seen ebx set as 0 instead:
;Read and store the user input
mov eax, 3
mov ebx, 0
mov ecx, num
mov edx, 5 ;5 bytes (numeric, 1 for sign) of that information
int 80h
I have tried setting ebx to 0 and 2, and they both work fine without issues. Can you explain to me which is the better option to use? Or is there other approaches I should take for best practices?