Thanks for the reply... I am attaching some code and output:

#include <stdio.h>
int main() {
       char name[50] = "Nobody";
       FILE* file = fopen("name", "r");
       printf("What is your name?\n");
       fprintf(stdout, "Reading from file...\n");
       fscanf(file, "%s", name);
       fscanf(stdin, "%s", name);
       printf("My name is %s\n", name);
       fprintf(stderr, "I am alive!!!\n");
       fclose(file);
       return 0;
}

$ cat name
Turing
$ qemu-system-arm -M netduino2 -nographic -semihosting -kernel vp2.bin
What is your name?
Reading from file...
My name is Turing
I am alive!!!
$

Basically the scanf call has no effect. I was expecting a pause in
execution to input a string, but nothing happens.

Regards,
----
Bruno Prado


On Thu, Oct 1, 2020 at 5:38 PM Peter Maydell <peter.mayd...@linaro.org>
wrote:

> On Thu, 1 Oct 2020 at 21:33, Bruno Prado <br...@dcomp.ufs.br> wrote:
> > I was able to use stdout, stderr for output and files for
> > both input and output in qemu-system-arm, but stdin is not
> > working (always returns -1 from syscall). I found no
> > information and have already checked the code for possible hints.
>
> Rather hard to say what might be going on with this little
> information... what semihosting calls are you making, what
> do you expect them to do and what do they actually do?
> Do you have a minimal test case we can reproduce with?
>
> thanks
> -- PMM
>

Reply via email to