You really want the linux-c mailing list for this kind of question, but
I'll try to help.
What does "not execute at all" really mean? Clearly it is executing, if
it isn't you've got major filesystem/kernel problems. The question is
"WHAT is it executing?" I think your problem may be that you are
dup'ing the wrong fileno. I think (and I can't put my hands on my refs
this late at night) that STDIN is 0, not 1.
In any case, put some test lines in your program. Things like:
printf("This is just before the Line Of Death\n");
yada yada yada
printf("The foo function returned: %d\n", foo(arg));
gangadharan narayan wrote:
>
> Hi guy's
>
> I am trying to write a program
>
> to read from the standard input.
>
> I used the read function. The call
> was
> read ( STDIN_FILENO,buf,BUFFIZE);
>
> everyting was OK. The prgram ran
> succesfully and was reading from thhe
> standard input.
>
> Later i duplicated the file descripter
> for the standard input ( i.e 1) using
> the dup function call .
>
> The call was
> newfd = dup(1);
>
> Nowi re wrote the read call as
>
> read(newfd,buf,BUFFSIZE);
>
> thhe program compiled , but for
> reasons unknown to me it did not
> execute at all.
>
> can any onetell me what was thhe
> problem ?
>
> thhanks for the help in advance
>
> _______________________________________________________________
> Get Free Email and Do More On The Web. Visit http://www.msn.com
--
My public encryption key is available from
www.az.com/~drysdam/crypt/rysdam.gpg.html
and of course www.keyserver.net