473,395 Members | 1,571 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

process steering with pipes

Hi,

does anyone have an idea for this problem:

I use anonymous pipes to steer a console program under Win2000 with a
second 'steering aplication'. The stdin and output are redirected to
pipes.

The console application has several fgets() and fgetc() to read
strings and chars. This works very fine with the pipes.

But, there is one point where the console application uses kbhit() and
waits for a key to be hit. It seems not possible to use the pipes to
get out of the loop

while( ! kbhit() )...
I do not want to use the keyboard and I can not change the console
application, since I do not have the sources.

Is there a way to make the one program simulate this event in a way
that the console application's line while(!kbhit())... is satisfied?

Thanks a lot,
Hans J. Brinksmeyer
Nov 14 '05 #1
9 2528
On Thu, 02 Dec 2004 08:30:13 -0800, Hans J?rg Brinksmeyer wrote:
Hi,

does anyone have an idea for this problem:

I use anonymous pipes to steer a console program under Win2000 with a
second 'steering aplication'. The stdin and output are redirected to
pipes.

The console application has several fgets() and fgetc() to read
strings and chars. This works very fine with the pipes.

But, there is one point where the console application uses kbhit() and
waits for a key to be hit. It seems not possible to use the pipes to
get out of the loop

while( ! kbhit() )...

Unfortunately kbit() (and indeed "anonymous pipes") are not defined by the
C programming language, they are Windows related features. A good place
to discuss them would be comp.os.ms-windows.programmer.win32.
I do not want to use the keyboard and I can not change the console
application, since I do not have the sources.

Is there a way to make the one program simulate this event in a way that
the console application's line while(!kbhit())... is satisfied?


Again, the C language doesn't begin to address an issue like this, ask the
Windows experts.

Lawrence
Nov 14 '05 #2
"Lawrence Kirby"
Hans J?rg Brinksmeyer wrote:

[OT OP snipped]
Unfortunately kbit() (and indeed "anonymous pipes") are not defined by the
C programming language, they are Windows related features. A good place
to discuss them would be comp.os.ms-windows.programmer.win32.


Rats! I thought not having to deal with crappy plumbing was the silver
lining to using my platform. A fresh hell awaits.... MPJ
Nov 14 '05 #3
Merrill & Michele wrote:
"Lawrence Kirby"
Hans J?rg Brinksmeyer wrote:


[OT OP snipped]
Unfortunately kbit() (and indeed "anonymous pipes") are not defined by the
C programming language, they are Windows related features. A good place
to discuss them would be comp.os.ms-windows.programmer.win32.


Rats! I thought not having to deal with crappy plumbing was the silver
lining to using my platform. A fresh hell awaits.... MPJ


Now what does this add to the discussion other than noise? Every
article need not be treated as a fresh opportunity for a "witty"
comment. I am not ROTFLMAO.

--
Chuck F (cb********@yahoo.com) (cb********@worldnet.att.net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net> USE worldnet address!
Nov 14 '05 #4
> A good place
to discuss them would be comp.os.ms-windows.programmer.win32.


Lawrence,

thank you for this hint. I'm not a C expert ;-)
Since I thought the console app is designed in plain C I have choosen
this forum here.

Best regards,
Hans
Nov 14 '05 #5

"CBFalconer"
Merrill & Michele wrote:
"Lawrence Kirby"
Hans J?rg Brinksmeyer wrote:


[OT OP snipped]
Unfortunately kbit() (and indeed "anonymous pipes") are not defined by the C programming language, they are Windows related features. A good place
to discuss them would be comp.os.ms-windows.programmer.win32.


Rats! I thought not having to deal with crappy plumbing was the silver
lining to using my platform. A fresh hell awaits.... MPJ


Now what does this add to the discussion other than noise? Every
article need not be treated as a fresh opportunity for a "witty"
comment. I am not ROTFLMAO.


Every five minutes, a unix user posts something about pipes not working. I
didn't think it was an issue for my platform, but apparently it is. I was
happy to learn simultaneously of the existence and non-conforming nature of
anonymous pipes. MPJ
Nov 14 '05 #6
If this is REALLY what you've got to do then the remote process and use some
assembly code and do "out"'s to the chip that handles the KB IO. This is
typically an 8048 or 8042 Intel chip, and the port to out to is 60H. Once
this port is written to the 8259 Interrupt controller will fire, and you
could get the address from there instead and just fire that int handler.

An easier way may be to use the MS-DOS interrupt 09 (INT 09) which is a BIOS
handler for the keyboard.

A HUGE downside is that you have to have a controller system where you know
a user is NOT at the keyboard. It is actually a big kluge that I would NEVER
do. Why do you need to use a pipe anyways? Is the code already written for
the process that you are piping to?

"Hans J?rg Brinksmeyer" <ha********************@iav.de> wrote in message
news:9f**************************@posting.google.c om...
Hi,

does anyone have an idea for this problem:

I use anonymous pipes to steer a console program under Win2000 with a
second 'steering aplication'. The stdin and output are redirected to
pipes.

The console application has several fgets() and fgetc() to read
strings and chars. This works very fine with the pipes.

But, there is one point where the console application uses kbhit() and
waits for a key to be hit. It seems not possible to use the pipes to
get out of the loop

while( ! kbhit() )...
I do not want to use the keyboard and I can not change the console
application, since I do not have the sources.

Is there a way to make the one program simulate this event in a way
that the console application's line while(!kbhit())... is satisfied?

Thanks a lot,
Hans J. Brinksmeyer

Nov 14 '05 #7
mef526 <mi******@removecodeinsight.com> scribbled the following:
If this is REALLY what you've got to do then the remote process and use some
assembly code and do "out"'s to the chip that handles the KB IO. This is
typically an 8048 or 8042 Intel chip, and the port to out to is 60H. Once
this port is written to the 8259 Interrupt controller will fire, and you
could get the address from there instead and just fire that int handler. An easier way may be to use the MS-DOS interrupt 09 (INT 09) which is a BIOS
handler for the keyboard. A HUGE downside is that you have to have a controller system where you know
a user is NOT at the keyboard. It is actually a big kluge that I would NEVER
do. Why do you need to use a pipe anyways? Is the code already written for
the process that you are piping to?


Could you please discuss implementation-specific issues on an
implementation-specific newsgroup? This might come as a shock to you,
but not all systems have MS-DOS interrupts.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-------------------------------------------------------- rules! --------/
"As we all know, the hardware for the PC is great, but the software sucks."
- Petro Tyschtschenko
Nov 14 '05 #8
On Fri, 03 Dec 2004 00:19:19 -0800, Hans J?rg Brinksmeyer wrote:
A good place
to discuss them would be comp.os.ms-windows.programmer.win32.


Lawrence,

thank you for this hint. I'm not a C expert ;-)
Since I thought the console app is designed in plain C I have choosen
this forum here.


It is possible to run standard C apps as console applications, just as it
is possible to, say, run them from a Unix shell command prompt. However
each platform provides a myriad of extensions (i.e. non-standard features)
that can also be used (AFAIK console application can use pretty much the
full Win32 API). Your question was about keyboards and kbhit() which are
not covered by standard C, i.e. one of those extensions.

Lawrence

Nov 14 '05 #9
Hans J?rg Brinksmeyer wrote:
Hi,

does anyone have an idea for this problem:

I use anonymous pipes to steer a console program under Win2000 with a
second 'steering aplication'. The stdin and output are redirected to
pipes.

The console application has several fgets() and fgetc() to read
strings and chars. This works very fine with the pipes.

But, there is one point where the console application uses kbhit() and
waits for a key to be hit. It seems not possible to use the pipes to
get out of the loop

while( ! kbhit() )...
I do not want to use the keyboard and I can not change the console
application, since I do not have the sources.

Is there a way to make the one program simulate this event in a way
that the console application's line while(!kbhit())... is satisfied?

Thanks a lot,
Hans J. Brinksmeyer


I do not think so. The problem is that kbhit() probably doesn't use
stdin or stdout at all but reads directly from the keyboard...
Nov 14 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Peter Åstrand | last post by:
There's a new PEP available: PEP 324: popen5 - New POSIX process module A copy is included below. Comments are appreciated. ---- PEP: 324 Title: popen5 - New POSIX process module
18
by: jas | last post by:
Hi, I would like to start a new process and be able to read/write from/to it. I have tried things like... import subprocess as sp p = sp.Popen("cmd.exe", stdout=sp.PIPE)...
3
by: norm4h8 | last post by:
Hi! I have a question about how to create a process in such a way that it would terminate itself if its wated for input for too long. Here is the story. I have 2 different files, say R.c and...
13
by: bayer.justin | last post by:
Hi, I am trying to communicate with a subprocess via the subprocess module. Consider the following example: <subprocess.Popen object at 0x729f0> Here hey is immediately print to stdout of...
2
by: kirk | last post by:
Can someone tell me the cleanest way to achieve this --> I have a running C# tray application. It has a tray menu to let the user turn on and off things, like monitoring the CPU usage for...
7
by: ecir.hana | last post by:
Hello, just to recap: last time I asked how to do an interprocess communitation, between one Manager process (graphical beckend) and some Worker processes. I decided to go with sockets,...
5
by: Mirxon | last post by:
Hello, I'm working on a C program under Ubuntu. It's basd on socket. Browser calls a client cgi (C program), and send some parameters to server (C program). Server runs another program...
3
by: Michael Justin | last post by:
Mufasa wrote: Message Oriented Middleware might be an option too: http://en.wikipedia.org/wiki/Message-oriented_middleware There are many very good (including Open Source implementations)...
5
by: Markgoldin | last post by:
I am searching for a solution of sending messages from not .Net process into a .Net process written in C#. I have gone already thru sockets solution and have porblems with it. I am not a C# coder...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.