Re: std::cin in Fiasco/L4Re (with 'make qemu')
Adam Lackorzynski <[email protected]>
| Newsgroups | gmane.comp.micro-kernel.l4.devel |
|---|---|
| Message-ID | <[email protected]> |
On Wed Apr 02, 2014 at 01:14:15 +0200, Emanuel Berg wrote: > Adam Lackorzynski <[email protected]> writes: > > > Add REQUIRES_LIBS += libc_be_file_stdin to your > > Makefile. > > That gets the execution to halt but what I input is > apparently interpreted as a "command" because it says > > unknown command: '2' > > if for example I press 2 and RET. > > Same for std::cin and scanf. I'm not sure where you enter this. For me, the following works quite fine: #include <stdio.h> int main(void) { printf("Press some key: "); char c = getchar(); printf("\nYour input: %c (%d)\n", c, c); printf("Enter a number: "); int number; scanf("%x", &number); printf("Your number: %d\n", number); return 0; } Makefile: PKGDIR ?= ../../.. L4DIR ?= $(PKGDIR)/.. TARGET = stdin SRC_C = stdin.c REQUIRES_LIBS = libc_be_file_stdin include $(L4DIR)/mk/prog.mk Output: Press some key: a Your input: a (97) Enter a number: 0815 Your number: 2069 --------------------------------------------------------------------- CPU 0 [f00121f6]: IRQ ENTRY jdb: ^ Return reboots, "k" enters L4 kernel debugger... Rebooting. Shutting down... Adam -- Adam [email protected] Lackorzynski http://os.inf.tu-dresden.de/~adam/