Executable wrapped into another one: how to pass streams instead of real files?
I give you a simplified example to explain what I would like to do.
I have the following code, which I cannot modify (hello.cpp):
|#include <iostream>
#include <fstream>
using namespace std;
int main( int argc, char *argv[] )
{
string line;
ifstream f( argv[1] );
while(!f.eof())
{
getline(f, line);
cout << line << endl;
}
return 0;
}
Launch example:
||caneta@host ~ $ ./hello myfile.txt
1 - This is
2 - a test
3 - file.
I have a wrapper program which I need to modify:
||#include
On 21/06/11 14:42, Igor R wrote:
can I modify it in order to use a stream or a string inside the wrapper program, instead of using a file name?
Try to pass a name of named pipe, instead of the filename. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users I've tryed with pipes, but without success...could you please give me a WORKING example using my code?
-- Alessandro Candini MEEO S.r.l. Via Saragat 9 I-44122 Ferrara, Italy Tel: +39 0532 1861501 Fax: +39 0532 1861637 http://www.meeo.it ======================================== "ATTENZIONE:le informazioni contenute in questo messaggio sono da considerarsi confidenziali ed il loro utilizzo è riservato unicamente al destinatario sopra indicato. Chi dovesse ricevere questo messaggio per errore è tenuto ad informare il mittente ed a rimuoverlo definitivamente da ogni supporto elettronico o cartaceo." "WARNING:This message contains confidential and/or proprietary information which may be subject to privilege or immunity and which is intended for use of its addressee only. Should you receive this message in error, you are kindly requested to inform the sender and to definitively remove it from any paper or electronic format."
On 21/06/11 14:55, Igor R wrote:
I've tryed with pipes, but without success...could you please give me a WORKING example using my code? No, I doubt it's ever possible...
Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users Thank you.
-- Alessandro Candini MEEO S.r.l. Via Saragat 9 I-44122 Ferrara, Italy Tel: +39 0532 1861501 Fax: +39 0532 1861637 http://www.meeo.it ======================================== "ATTENZIONE:le informazioni contenute in questo messaggio sono da considerarsi confidenziali ed il loro utilizzo è riservato unicamente al destinatario sopra indicato. Chi dovesse ricevere questo messaggio per errore è tenuto ad informare il mittente ed a rimuoverlo definitivamente da ogni supporto elettronico o cartaceo." "WARNING:This message contains confidential and/or proprietary information which may be subject to privilege or immunity and which is intended for use of its addressee only. Should you receive this message in error, you are kindly requested to inform the sender and to definitively remove it from any paper or electronic format."
participants (2)
-
Alessandro Candini
-
Igor R