From: Richard Sammet <richard.sammet@sit.fraunhofer.de>
To: linux-c-programming@vger.kernel.org
Subject: how to find the end of piped data?
Date: Mon, 13 Sep 2004 13:36:35 +0200 [thread overview]
Message-ID: <41458643.7060907@sit.fraunhofer.de> (raw)
hey list,
i wrote a small tool which gets data over a pipe from other tools (like:
cat stuff | mytool).
how can i find the end of this data stream?
at the moment im looking for a newline to see if the input is finished,
but thats not practicable.
this is the rutine for getting the data:
75 void scanin()
76 {
77 int tmpcnt=0;
78
79 while(sizeof(tmpkey) && tmpkey[tmpcnt-1] != 10)
80 {
81 tmpkey[tmpcnt]=getchar();
82 tmpcnt++;
83 }
84 }
im looking for a flag like EOF but EndOfStream or something like this? ;)
anybody any idea?
e-axe
--
=====================================================================
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 reply other threads:[~2004-09-13 11:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-13 11:36 Richard Sammet [this message]
2004-09-14 6:06 ` how to find the end of piped data? Eric Bambach
2004-09-14 8:10 ` Charlie Gordon
2004-09-14 8:45 ` Richard Sammet
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=41458643.7060907@sit.fraunhofer.de \
--to=richard.sammet@sit.fraunhofer.de \
--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).