flat assembler
Message board for the users of flat assembler.
Index
> Windows > non-blocking STDIN read / find number of bytes in buffer |
Author |
|
vid 31 Oct 2006, 13:24
got it!
it's PeekNamedPipe (pretty self-explaining name, eh?) now i just need same for linux (kernel call) :/ |
|||
31 Oct 2006, 13:24 |
|
vid 31 Oct 2006, 13:34
got it!
it should be enough to set O_NONBLOCK before reading and clear it afterwards. hehe, i'm posting 3 times in a row, might be some kind of disease |
|||
31 Oct 2006, 13:34 |
|
shoorick 31 Oct 2006, 14:02
self-service
|
|||
31 Oct 2006, 14:02 |
|
vid 01 Nov 2006, 17:55
SHIT!!! PeekNamedPipe doesn't work with STDIN.
any ideas? |
|||
01 Nov 2006, 17:55 |
|
chris 02 Nov 2006, 03:28
I think here is right place to go:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/console_functions.asp as for non-blocking read from console, there is a C/C++ lib function _getch_nolock() as you can find in: http://msdn2.microsoft.com/zh-tw/library/236adc23.aspx |
|||
02 Nov 2006, 03:28 |
|
vid 02 Nov 2006, 11:43
chris: thanks, but i have studied console functions already. getc()_closk() is not what i want too, i know how to do that. problem is that getc_lock() still blocks when there is nothing in input buffer (from previous read).
anyway, it seems that win just doesn't support this. I can go without it, but this way my routines will be quite uneffective on win32. (well... little more effective than libc maybe). |
|||
02 Nov 2006, 11:43 |
|
cod3b453 02 Nov 2006, 12:08
Not sure if this is what you want but heres some code:
Code: STD_INPUT_HANDLE equ 0xFFFFFFF6 ENABLE_LINE_INPUT equ 0x00000002 ;... hConI dd 0 Buffer rb 256 BufferSize dd ($ - Buffer) BytesRead dd 0 ;... invoke [hConI],GetStdHandle,STD_INPUT_HANDLE ; Get console handle mov [hConI],eax ; invoke SetConsoleMode,[hConI],ENABLE_LINE_INPUT ; Set input to line input ; This makes ReadConsoleA ; only return when the user ; presses enter invoke ReadConsoleA,[hConI],Buffer,BufferSize,BytesRead,NULL ; Read line into Buffer up to ; BufferSize bytes, put bytes ; written into BytesRead Or are you trying to do something else? |
|||
02 Nov 2006, 12:08 |
|
vid 02 Nov 2006, 12:22
again not it
|
|||
02 Nov 2006, 12:22 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.