This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: read and write to standerd IO


Satoshi Sasaki wrote:
read() failed if the following programs are executed.
test_prog() is executed as a thread.

int test_prog()
{
 char tmpbuf[5];

 write(1,"XXXX",4);
 read(0,&tmpbuf,4);
[snip]
Can I use standard input(fd number 0)?
Yes. The issue is that in the default configuration, stdio uses /dev/ttydiag, which is a TTY device over a "pretend" serial device that actually uses the HAL diagnostic I/O routines. These routines may or may not support input, and more importantly won't work if you're communicating via GDB.

Or is it necessary to call open() again from a user program?
You can do that, or you can change CYGDAT_LIBC_STDIO_DEFAULT_CONSOLE to select the TTY device you really want.

Jifl
--
eCosCentric http://www.eCosCentric.com/ <info@eCosCentric.com>
--[ "You can complain because roses have thorns, or you ]--
--[ can rejoice because thorns have roses." -Lincoln ]-- Opinions==mine


--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]