471,624 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,624 software developers and data experts.

Errors returned by System()function

I'm attempting to debug some code that uses the System function. When the
function is called, it returns Error 1. Does anyone know what that error
might be, or where I can find a list of error codes for the function?

Any help is most appreciated.

--
Randy Jackson
http://fourcolorexplosion.com
Jul 17 '05 #1
1 2253
["Followup-To:" header set to comp.lang.php.]
Randy Jackson wrote:
I'm attempting to debug some code that uses the System function. When the
function is called, it returns Error 1. Does anyone know what that error
might be, or where I can find a list of error codes for the function?


The System() function returns a string!

If you mean it returns the string "Error 1", that means it executed the
specified command succesfully and /that/ command (whatever it was)
produced an output for which the last line was "Error 1".

If, on the other hand, you mean that the System() call returned false
(indicating a failure of the specified command) and that the second
parameter is 1 after the call, then it is the command you call within
the System() function that has the responsability for that.
For example ('echo $?' prints the exit status of the last command):

php$ nocommand
bash: nocommand: command not found
php$ echo $?
127

Seems that bash exits with a exit code of 1 when it can't find the
command
php$ wget http://www.baddomain.net/index.html
--21:57:02-- http://www.baddomain.net/index.html
=> `index.html.1'
Resolving www.baddomainhere.net... failed: Host not found.
php$ echo $?
1

Seems that wget exits with a exit code of 1 when it can't resolve the
domain part of the URL
php$ calc 78 + 3
81
php$ echo $?
0

Seems that calc exits with a exit code of 0 when it works properly (as
do most (all?) other programs)

--
Mail sent to my "From:" address is publicly readable at http://www.dodgeit.com/
== ** ## !! !! ## ** ==
TEXT-ONLY mail to the complete "Reply-To:" address ("My Name" <my@address>) may
bypass the spam filter. I will answer all pertinent mails from a valid address.
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by praba kar | last post: by
8 posts views Thread by Nick Li | last post: by
7 posts views Thread by Harsh_forC | last post: by
16 posts views Thread by BHARAT MEHTA | last post: by
8 posts views Thread by bob | last post: by
2 posts views Thread by nnandini8 | last post: by
3 posts views Thread by extrnh | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.