delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/06/17:19:30

Message-Id: <3.0.32.19971003105005.0068b970@mail.santandersupernet.com>
Date: Mon, 06 Oct 1997 23:13:45 +0200
To: djgpp AT delorie DOT com
From: Jose Luis Perandones Colino <joepc AT writeme DOT com>
Subject: Correct redirection
Mime-Version: 1.0

I use:


a=open(templa,O_CREAT|O_RDWR|O_TRUNC|O_TEXT,S_IWUSR);

if (a<<0) 

  {

   perror("Temp file");

   return 1;

  }


close(fileno(stdout));

dup2(a,fileno(stdout));

close(a);

/*

 Execute a DOS program that i want get output

*/

close(fileno(stdout));

dup2(oldstd,fileno(stdout));

close(oldstd);


But if i use the standar output i don't redirect the output of my program ( i can't use myprogram.exe > out.txt ) becasuse it lost.


Ciao and thanks.



<center><bold><bigger><bigger>Jose Luis Perandones Colino

</bigger></bigger></bold><italic>mailto:joepc AT writeme DOT com

EmuWorks - http://www.geocities.com/SiliconValley/Bay/9494

</italic></center>

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019