flat assembler
Message board for the users of flat assembler.
Index
> Linux > Reading works from console, but not from a file (cat n | pro |
Author |
|
lsa 02 Feb 2009, 16:12
The console is line buffered.
This is not the case when reading from stdin (unless the data is sent as such (like when using a console)). So if you have this: 20 30 40 In some file (say 'n') you read 20 chars (everything, not 20 chars on a single line). You need to split the lines youself. Maybe this is your problem. It`s not like <STDIN> in perl (Which as i remember always reads a line). |
|||
02 Feb 2009, 16:12 |
|
Ton 02 Feb 2009, 19:39
Isa, you're right.
Code: mov eax, 3 ; sys_read mov ebx, 0 ; stdin mov ecx, buf mov edx, 0x4 ; read exactly four characters int 0x80 $ more n 123 234 345 $ cat n | ./prog 246 468 690 |
|||
02 Feb 2009, 19:39 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.