The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 05-23-2007
porter porter is offline
Registered User
 

Join Date: Jan 2007
Posts: 2,965
1. Use one descriptor opened read/write and use it for stdin/stdout/stderr rather than opening twice.

as in the single "open(con,O_RDWR)"

2, try using write and read to confirm input/output before using the stdio APIs.

3. Also, check that you actually need the dup2s, as you have already done close(0/1/2)

try

fd=open(con,O_RDWR);
dup2(1,fd);
dup2(2,fd);
Reply With Quote