STDIN_FILENO and STDOUT_FILENO

Hello,

i try to use these defines as follow:

char buf[1000];

fgets(buf, sizeof(buf), STDIN_FILENO);
fputs(buf, STDOUT_FILENO);


With this code i get ever segmentation faults (SIGSEGV).

How can i use the f* functions with stdin and stdout ?


Thank you very much for your help !

Fiffi <fiffismurf@oleco.net> wrote in message
news:b9hmtf$i7h$1@inn.qnx.com

Hello,

i try to use these defines as follow:

char buf[1000];

fgets(buf, sizeof(buf), STDIN_FILENO);
fputs(buf, STDOUT_FILENO);


With this code i get ever segmentation faults (SIGSEGV).

How can i use the f* functions with stdin and stdout ?

fgets(buf, sizeof(buf), stdin);
fputs(buf, stdout);

-xtang

Hello Xtang,

Your code works !

Thank you very much for your help !



“Xiaodan Tang” <xtang@qnx.com> schrieb im Newsbeitrag
news:b9hpl9$nra$1@nntp.qnx.com

Fiffi <> fiffismurf@oleco.net> > wrote in message
news:b9hmtf$i7h$> 1@inn.qnx.com> …
Hello,

i try to use these defines as follow:

char buf[1000];

fgets(buf, sizeof(buf), STDIN_FILENO);
fputs(buf, STDOUT_FILENO);


With this code i get ever segmentation faults (SIGSEGV).

How can i use the f* functions with stdin and stdout ?

fgets(buf, sizeof(buf), stdin);
fputs(buf, stdout);

-xtang