std::cin in Fiasco/L4Re (with 'make qemu')
adam at os.inf.tu-dresden.de
Tue Sep 23 07:31:09 CEST 2014
On Sat Sep 20, 2014 at 22:21:14 +0000, Stark, Josef wrote:
> >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;
> If I copy this code into the hello example, and change the Makefile accordingly:
> PKGDIR ?= ../..
> L4DIR ?= $(PKGDIR)/../..
> TARGET = hello
> SRC_C = main.c
> REQUIRES_LIBS = libc_be_file_stdin
> include $(L4DIR)/mk/prog.mk
> I can successfully run it IF moe runs hello directly
> (without Ned and a config, as a "make qemu E=hello" does).
> If, however, hello is run through a config file and therefore Ned,
> as in hello-cfg, it doesn't work. Execution does not halt and outputs
> invalid values:
> MOE: Starting: rom/ned rom/hello.cfg
> MOE: loading 'rom/ned'
> Ned says: Hi World!
> Ned: loading file: 'rom/hello.cfg'
> hello | Press some key:
> hello | Your input: � (-1)
> hello | Enter a number: Your number: -2147450972
> How to make it work? Pass a certain capability to hello?
Yes, add 'log = L4.Env.log' (not in 'caps' but besides it).
Adam adam at os.inf.tu-dresden.de
More information about the l4-hackers