On Mon, 31 Aug 2009 01:59:29 PDT madhu <iitmadhu at gmail.com> wrote:
> I copied above program to ding.c file and output I got is as follows: > > stati01 aime 250> cc ding.c -o ding > stati01 aime 252> ding true > system("true") returned 0x0, error 0x0, status 0x0 > stati01 aime 253> ding false > system("false") returned 0xff00, error 0x0, status 0xff > stati01 aime 256> ding nosuchcommand > sh: nosuchcommand: not found > system("nosuchcommand") returned 0x100, error 0x0, status 0x1 This all looks right to me: command runs ok with no output, status is 0. Command runs with error, status is 0xff. Command doesn't exist, status is 1. > stati01 aime 257> uname -a > SunOS stati01 5.10 Generic_137137-09 sun4u sparc SUNW,Sun-Fire-V240 > The same program running on my machine is giving status as 1. > Which is all causing problem to me. Seems like the issue is your machine, then. Try asking the shell for the return value for those three cases (typically "echo $?" after the command). <mike -- Mike Meyer <mwm at mired.org> http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org