About the printf

Qiang Wang rurality.wq@gmail.com
Thu May 7 13:40:00 GMT 2009


hello,

I use the newlib and make it support my kernel.

But, I found that the printf can not work nornally.
I used the following program to build the stdin, stdout, stderr. But
the printf can not print anthing but just write data into a buffer.
So, would anybody tell me how to establish the stdin stdout and stderr.

   stdin = fopen("/dev/tty", "r");
   if (stdin == NULL ) {
       printf("stdin: /dev/tty open failed\n");
       return;
   }

   stdout = fopen("/dev/tty", "w");
   if (stdout < 0) {
       printf("stdout: /dev/tty open failed\n");
       return;
   }

   stderr = fopen("/dev/tty", "w");
   if (stderr < 0) {
       printf("stderr: /dev/tty open failed\n");
       return;
   }


best regards

wangqiang



More information about the Newlib mailing list