473,606 Members | 2,115 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Redirecting standard input for external application

Is it possible to redirect the standard input for an external application?

Something like:
ifstream in (...);
std::streambufx oldbuf = cin.rdbuf(in.rd buf());
system(...);
cin.rdbuf(oldbu f);

The proces must run another program where the input for this external
program is allready present in memory of the original proces.

Gerrit
Jul 22 '05 #1
1 2257

"Gerrit Hulleman" <hu******@lup us-delta.tmfweb.nl > wrote in message
news:40******** *************@n ews.xs4all.nl.. .
Is it possible to redirect the standard input for an external application?

Something like:
ifstream in (...);
std::streambufx oldbuf = cin.rdbuf(in.rd buf());
system(...);
cin.rdbuf(oldbu f);

The proces must run another program where the input for this external
program is allready present in memory of the original proces.

Gerrit


Not in standard C++, you certainly can do this on Unix and Windows but in
both cases you need to use non-standard OS-specific API calls. Ask on a
group dedicated to whatever operating system you are using.

john
Jul 22 '05 #2

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

Similar topics

0
2574
by: Christophe HELFER | last post by:
hi, I have some problem with redirecting input and output from a process. I can only use VB language (sorry...) Situation: I have to use the Cisco Network Registrar (DNS And DHCP server) command line utility as redirecting its input and output so I can interact with this one. This utility is similar to ftp under a win32 console. It proposes its own prompt after launching it.
2
3120
by: Robert Oschler | last post by:
I am working on a PHP 4 app that interacts with an external authorization server. The external server does "third-party" authorization of users. So I do the following: 1) Each of my PHP scripts has an include file (require_once) that checks to see if the current user has recently been authorized. 2) If not, the user is "handed off" to the external server. I do this by building the necessary URL for authorization and using refresh to...
15
3095
by: Matt Burland | last post by:
I'm having a problem with redirecting the StandardOutput of a process that I use to run a DOS program in my application. The problem is that I when I start my process (which I do in a separate thread) I can't read anything from the stdout before the process actually finishes. If I do something like this: Process myProcess = new Process(myStartInfo) // this gets shown straight away MessageBox.Show("Process Started"); string s =...
2
4571
by: Jacek | last post by:
Hello! My application has to use external native library writing to stdout and stdin. My goal is to redirect output within running process (no chance to do that in child process - Process class redirection is useless in that case) and I would like to do it without reverting to C-run time library P/Invoke calls. Any ideas how to do that?
2
299
by: jerry | last post by:
Using VB.net standard 2003. While in development environment can create process to execute an external EXE program and redirect output to "file.txt" using System.Diagnostic.Process.Start. If I launch the created vbnetprogram.exe file, either debug or release, output form external EXE file is not written to "file.txt". Any suggestions?
6
4162
by: Christophe Helfer | last post by:
hi, I have some problem with redirecting input and output from a process. Situation: I have to use the Cisco Network Registrar (DNS And DHCP server) command line utility as redirecting its input and output so I can interact with this one. This utility is similar to ftp under a win32 console. It proposes its own prompt after launching it. What I want to do is:
3
8455
by: Sudesh | last post by:
Hi, I am a newbie to C# and Im trying to redirect standard input, output and error of a console program written in C (MS VC 6.0) to a textbox on a form. The code for the redirecting looks like this: private System.IO.StreamWriter c_StreamInput = null; private System.IO.StreamReader c_StreamOutput = null; private Thread c_ThreadRead = null; private Process c_Process = null;
2
1679
by: Magnus | last post by:
I'm currently developing an application with classified information as input to a couple of algorithms. Which strategy should I use to protect the input data from beeing read? The files should be files on the local computer in the application directory structure and it must be possible to update the input data with an external application. My current approach is to deserialize the input data in the "external application" and then...
1
6686
by: Lincoln Yeoh | last post by:
Hi, I've just started to learn python (I've been using perl for some years). How do I redirect ALL stderr stuff to syslog, even stderr from external programs that don't explicitly change their own stderr? Say I have a program called foo: #!/usr/bin/python
0
8009
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8432
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8428
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8299
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6753
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5456
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3919
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3964
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1548
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.