std::cin in Fiasco/L4Re (with 'make qemu')
Adam Lackorzynski
adam at os.inf.tu-dresden.de
Wed Apr 2 16:54:15 CEST 2014
On Wed Apr 02, 2014 at 01:14:15 +0200, Emanuel Berg wrote:
> Adam Lackorzynski <adam at os.inf.tu-dresden.de> 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 adam at os.inf.tu-dresden.de
Lackorzynski http://os.inf.tu-dresden.de/~adam/
More information about the l4-hackers
mailing list