linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: joy <gracecott@sancharnet.in>
To: lantis@iqranet.info, linux-c-programming@vger.kernel.org
Subject: Re: various doubts part 2
Date: Wed, 11 Aug 2004 08:22:08 +0530	[thread overview]
Message-ID: <411989D8.1030000@sancharnet.in> (raw)
In-Reply-To: <1092121443.1419.3.camel@linux.local>

Sascha Retzki wrote:

>Am Di, 2004-08-10 um 04.53 schrieb joy:
>  
>
>>	outfile = open(filename,O_WRONLY|O_CREAT,S_IRWXU|S_IRWXO);
>>	while((bytes_read = read(STDIN_FILENO,buff,sizeof(buff))>0))
>>	{
>>		if((bytes_written = write(outfile , buff ,bytes_read))!=bytes_read)
>>		{
>>			fprintf(stderr,"write error");
>>			exit(1);
>>		}
>>	}
>>    
>>
>
>Why not reading from 'stdin' directly ? That FD is defined in stdio.h
>iirc... What is STDIN_FILENO anyway :) ?
>  
>
Also a defined contant,  and corresponds to the fd of stdin 
(0).(Stevens, adv., prog in unix env.,)
Anyways ,I used fread and fwrite and the fellow seems to work.
guess you have to treat stdin as streams only.

Joy.M.M

  reply	other threads:[~2004-08-11  2:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-10  2:53 various doubts part 2 joy
2004-08-10  7:04 ` Sascha Retzki
2004-08-11  2:52   ` joy [this message]
2004-08-11 22:21     ` Luiz Fernando N. Capitulino
2004-08-12 10:49       ` joy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=411989D8.1030000@sancharnet.in \
    --to=gracecott@sancharnet.in \
    --cc=lantis@iqranet.info \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).