Iostream and string in L4Re
Adam Lackorzynski
adam at os.inf.tu-dresden.de
Mon Jan 5 00:17:30 CET 2015
On Tue Dec 23, 2014 at 18:01:54 +0700, Erry Pradana Darajati wrote:
> Hi,
> I already fix the line to this line >> REQUIRES_LIBS +=
> libc_be_file_stdin libstdc++
> but it still gave error. But the error is not in the compiler. It's on the
> linker.
> My code is like this :
>
> char cmd[12] ;
> printf("Initialization Finished\n");
> while(1)
> {
> printf("erry at erry-OS : \t");
> gets(cmd);
> if(strcmp(cmd,"clear")==0)
> {
> .............
> It gives undefined referenced error to gets in main.o (Liunker error not
> compiler error). Where do i go wrong. And also, how to use getline() in
> this scope ?
Yes, 'gets' is missing as it's deprecated and shall not be used. Use a
different function, such as fgets (as the man-page suggests). Regarding
getline, it should just work?
> >> And also, how to make hello-cfg be able to accept keyboard input. I have
> >> already include libc_be_file_stdin and include line below in my hello.cfg
> >> but it still not working :
> >>
> >> *L4.default_loader:start({ caps = { log = L4.Env.log,},l4re_dbg =
> >> L4.Dbg.Warn,log = { "l4linux", "yellow" },}, "rom/hello");*
> >
> >That looks ok to me. How are you trying to get the input in your
> >program?
>
> I'm trying to get input using getchar(). But when i load the kernel. It's
> still skips the input sequence and going into loop (I'm accpeting the
> keyboard input inside While(1))
With libc_be_file_stdin included in the Makefile it should actually not
do that. It returns -1? What does 'read' return for a
{ char s[3]; read(0, s, 3); }?
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