Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Oct 2001 12:45:53 GMT
From:      Cliff Sarginson <cliff@raggedclown.net>
To:        Giorgos Keramidas <charon@labs.gr>, Matthew Blacklow <matthew.blacklow@ticca.com>, freebsd-questions <freebsd-questions@FreeBSD.ORG>
Subject:   Re: C clue on FreeBSD again!
Message-ID:  <E15w0wL-000MAg-00@post.mail.nl.demon.net>

next in thread | raw e-mail | index | archive | help
> On Tue, Oct 23, 2001 at 02:50:21PM +1000, Matthew Blacklow wrote:
> > Yesterday I made a post asking how to suppress the output of a program
> > spawned in C using the System() function.
> > The replies I had were very helpful and successfully supressed the output.
> > However they worked a little too good and they even suppressed the return
> > value of the program which i really need to capture.
> 
> You are not giving enough details for anyone to be able to help you
> with the specific problem.  Show us the relevant source of your
> program, and the exact commands that you are trying to system().
> 
> We can only guess what you are trying to do, and your `return value'
> is not something you did mention in the original question.  Give more
> details, please, on:
> 
> a) What exactly you are trying to do?
> b) How are you trying to do it?
> c) How does it fail to meet your requirements?
> 
> -giorgos

The return value from "system" won't be of much use to you, it will
only indicate if the "system" call managed to successfully exec the
program you asked it to. Actually, "system" is also a highly
unportable thing to use, if that is of any importance to you.

Having said that I am talking about most implementations of "system" ..
someone will correct me if I am wrong about it on FreeBSD.

Generally however If you want the return/exit value you will need to take a different
approach, probably using fork/exec/wait calls. Or in some kludgy
way have the return value from the program stored somehow.

But as giorgos said if you perhaps sent some code fragments of what
you are trying to do you may get some more specific suggestions.

-- 

Regards
Cliff


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E15w0wL-000MAg-00>