stdout redirected?


 
Thread Tools Search this Thread
Operating Systems Solaris stdout redirected?
# 1  
Old 02-10-2007
stdout redirected?

Hi all,

I have a c++ program which is running fine but has some printfs which its spews on to the screen, which I need for debugging.

But, I execute this program through a java, i.e I run a java program which actually launches my c++ executable and when it does this, I see none of my printfs doing their job(or r they?).

Is the stdout being redirected by someone(cause the c++, program is quite old, and has been edited by people earlier to me). what shouls I be looking for in the program to see for redirections. Cause when I searched for stdout to see, if any over riding has been done, couuld not find any.

Is it that, when this c++ program is run under the scope of some other program the stdout points nowhere and all the print messages are obliterated?
# 2  
Old 02-11-2007
Firstly debugging information should go to stderr, not stdout.

When you run the program from within your java program the sterr and stdout are those of the java application, and by default the output from your application is just ignored. In order for them to be displayed you would need to either redirect them to a file, or create pipes for the stdout and stderr from your application and read and them reproduce them to stdout or stderr in your java application. The former would be a lot simpler.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Deleting redirected pwd from file.

Hi echo " username " read username echo "password" stty -echo read password stty echo through read i am taking standard input and redirecign them to a file echo " username=${username}/${password} " > file.lst now from the same shell script i want to delete the password (i.e... (4 Replies)
Discussion started by: rosheks
4 Replies

2. AIX

Message redirected from syslog

Hi. recently in many of our lpars we are getting a message in errpt as "C6ACA566 0315094014 U S dtc MESSAGE REDIRECTED FROM SYSLOG". I have also checked the /etc/syslog.conf file. It doesn't point to error log. Can someone please advise about how to fix this error ? pmut3:/> errpt -aj... (4 Replies)
Discussion started by: newtoaixos
4 Replies

3. UNIX for Dummies Questions & Answers

How to get redirected filename inside unix script

Hi All, I am having a script which calculate checks the input feed and perform some function. When i am executing this script i am redirecting this to a output file. I want to know the redirected output file name inside my scripts. Is there is any way to get that . like the same way we... (4 Replies)
Discussion started by: arunkumar_mca
4 Replies

4. Solaris

Error messgaes can not be redirected

# whoami 2>/dev/null whoami: not found # Why the error message not getting redirected to /dev/null ... The shell is # echo $SHELL /sbin/sh For other commands it is working # ls aaa 2>/dev/null # Is there any other way to redirect the err msg from whoami Thank you for your... (7 Replies)
Discussion started by: Anu_1
7 Replies

5. UNIX for Dummies Questions & Answers

redirected output not going to file for all cases

I have to confirm that an engine was not able to run. In the output below you see that it indeed got errors, but it didn't send those messages to the output file. When I run the same thing with a different executable it works. So does this mean something in the executable could cause it not to... (7 Replies)
Discussion started by: brdholman
7 Replies

6. UNIX for Dummies Questions & Answers

find cannot be redirected to specific stdout ?

I tried to redirect the find command to a file (using find ..... > asdf ) and the file asdf is always empty . The results keep appearing on the screen. Is there another way to do this ? hmm . i just figured out that the file is empty only when in fact all results of the find command give a... (1 Reply)
Discussion started by: Shady_Creeper
1 Replies

7. AIX

search for a file - errors redirected

hi all, i do search for a file in solaris box in the following format find / -name 'file' -print 2>/dev/null i tried the same thing on AIX box; as i am searching from the root the same way i redirected the errors to /dev/null but find is showing strip off errors and when i just continued... (1 Reply)
Discussion started by: matrixmadhan
1 Replies

8. Shell Programming and Scripting

redirected output

Hello Everyone, I have an option for users in my shell script to create log file. So if user saying “yes” on it, I'm redirecting all output to log file by doing this: > /output.log. However I would like the output being displayed on the screen at the same time. Is it possible? If yes, does anybody... (2 Replies)
Discussion started by: slavam
2 Replies

9. UNIX for Dummies Questions & Answers

Standard output not redirected from /bin/sh

I have an application which has a lot of cout & cerr statements. This application also opens a log file (for eg a.log). When this application is run from the inittab file as follows /bin/sh -c " . /etc/timezone; exec /test" all the cout & cerr statements are printed in the log file... (1 Reply)
Discussion started by: soorajmu
1 Replies

10. UNIX for Dummies Questions & Answers

Saving a redirected file

What command do I use in order to save a file in directory A/B/C to directory A/D/E. (1 Reply)
Discussion started by: JSP
1 Replies
Login or Register to Ask a Question