🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #8560

Re: writing an app that can accept a pipe

#8560
From: Jeff Kish
Date: Fri, 15 Oct 2004 02:08
59 lines
2270 bytes
On Thu, 14 Oct 2004 12:46:51 -0400, JF Jolin <jfj@nospam.com> wrote:

>14 Oct 2004 09:34:00 -0400, Jeff Kish <jeff.kish@mro.com> wrote:
>
>> Hi.
>>
>> If I wanted to write an app that accepted output from another program,
>> say, stdou and was able to read the input stream, how would I go about
>> that?
>>
>>
>> For example, say I frequently do this at the command line:
>>
>> grep -di "<tag" *.xml
>>
>> and wanted to pipe all the matches to an app that would be able then
>> to parse the input, what would be the general approach, and if
>> possible the call's I'd need to make to either the VCL or API to have
>> this occur?
>>
>> Thanks
>>
>> Jeff Kish
>>
>
>
>Simple basic instructions in a console application would do the work.
>
>Upper.c
>-------
>#include <stdio.h>
>#include <string.h>
>void main(void)  {
>   char LineRead[255];
>   while (fgets(LineRead, sizeof(LineRead), stdin))
>     fputs(strupr(LineRead), stdout);
>}
>
>followed by:   grep -di "<tag" *.xml | Upper.exe
>
>In a non-console application you can use dedicated API among:
>
>GetStdHandle
>CreateFile
>CreateConsoleScreenBuffer
>ReadFile
>WriteFile
>DuplicateHandle
>CloseHandle
>
>
>JF Jolin
>[Montreal, Canada]
>
>
>
>
>
thanks. I guess I'd start off with getstdhandle and go from there?
Technical Details
Message-ID: <68cum0hiuo60dkc998v6urhht2f34skavv@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!ecngs!feeder.ecngs.de!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <quvsm0llngc543ujq31ksi8c29acs65g5l@4ax.com> <opsfvcwd0wz6rw7b@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,d751b074fabd6dfb
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Jeff Kish <kishjjrjj@provide.net>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: writing an app that can accept a pipe
Date: Thu, 14 Oct 2004 22:08:38 -0400
Message-ID: <68cum0hiuo60dkc998v6urhht2f34skavv@4ax.com>
References: <quvsm0llngc543ujq31ksi8c29acs65g5l@4ax.com> <opsfvcwd0wz6rw7b@newsgroups.borland.com>
X-Newsreader: Forte Agent 2.0/32.646
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 216.86.91.24
X-Trace: newsgroups.borland.com 1097806346 216.86.91.24 (14 Oct 2004 19:12:26 -0700)
Lines: 59
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!ecngs!feeder.ecngs.de!npeer.de.kpn-eurorings.net!feed.news.schlund.de!schlund.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail