From: Richard Sammet <richard.sammet@sit.fraunhofer.de>
To: eric@cisu.net
Cc: linux-c-programming@vger.kernel.org
Subject: Re: how to find the end of piped data?
Date: Tue, 14 Sep 2004 10:45:38 +0200 [thread overview]
Message-ID: <4146AFB2.7050900@sit.fraunhofer.de> (raw)
In-Reply-To: <200409140106.08674.eric@cisu.net>
k, thx, it works fine...
e-axe
Eric Bambach wrote:
> Yea, heres a small program I wrote that works exactly the same way. WIth piped
> data. It just scans STDIN to match to a pattern in the input stream. If it
> finds it, it pipes to /dev/null, if not, it pipes to stdout. Notice the
> read()/write() combo with a buffer. This is MUCH faster than getchar()
> method. Hope it helps.
>
> int read_message(char *buffer){
> int len;
> len = read(STDIN_FILENO,buffer,BUFFERSIZE-1);
> if (len < 0){
> perror("Read Error");
> exit(EXIT_NOMATCH);
> }
> return len;
--
=====================================================================
Fraunhofer-Institut für Sichere Informations-Technologie (SIT)
Richard Sammet
Tel.: +49 6151 869 60027
Email: richard.sammet@sit.fraunhofer.de
main(){int
y=0,x;while(y!=6){x=(y==0)?101:((y==1)?45:((y==2)?97:((y==3)?120:((y==4)?101:10))));putchar(x);y++;}}
-
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2004-09-14 8:45 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-13 11:36 how to find the end of piped data? Richard Sammet
2004-09-14 6:06 ` Eric Bambach
2004-09-14 8:10 ` Charlie Gordon
2004-09-14 8:45 ` Richard Sammet [this message]
2004-09-14 9:03 ` Charlie Gordon
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=4146AFB2.7050900@sit.fraunhofer.de \
--to=richard.sammet@sit.fraunhofer.de \
--cc=eric@cisu.net \
--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).