Jump to content

Recommended Posts

Posted

is @error set by commands that are not listed to use it in the help file?

..another words, does every command set @error when it is done?

the reason i got suspicious was that i did a command like:

[loop]

$temp=stringstripws(filereadline($file),1)

if @error = -1 then exitloop

[endloop]

but the loop never finished. even though the help file does not specify that "stringstripws" sets @error, it appears that it does.

i'm not looking for help on the code, i've already taken care of it by breaking it down to seperate steps. main question still stands however.

Posted

I have tried a number of variations, and keep coming up with 0 for error.

Have you added a variable in your code, so you can store the error code, and simply use a messagebox, to show the result?

Posted

You're all missing the obvious. The problem is, every function resets @error to 0. You have nested function calls, so StringStripWS resets @error back to 0, thus you never get to see if FileReadLine set @error.

Posted

You're all missing the obvious.  The problem is, every function resets @error to 0.  You have nested function calls, so StringStripWS resets @error back to 0, thus you never get to see if FileReadLine set @error.

<{POST_SNAPBACK}>

True. stringstripws is the last function that's being called before it goes to the next line.
Posted

You're all missing the obvious.  The problem is, every function resets @error to 0.  You have nested function calls, so StringStripWS resets @error back to 0, thus you never get to see if FileReadLine set @error.

<{POST_SNAPBACK}>

Nah, the obvious was, did StringStripWS cause it to exit the loop. Like StringStripWS have a bug in it. Or the help guide have a bug, always good to check. :idiot:
Posted

You're all missing the obvious.  The problem is, every function resets @error to 0.  You have nested function calls, so StringStripWS resets @error back to 0, thus you never get to see if FileReadLine set @error.

<{POST_SNAPBACK}>

So the obvious solution would be to step out the functions you need to check the value of @error to have its own line, right?

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Posted

every function resets @error to 0.

this was exactly my question, thanx valik.

So the obvious solution would be to step out the functions you need to check the value of @error to have its own line, right?

i've already taken care of it by breaking it down to seperate steps.

:idiot:

PS> i'm not sure i like this behaviour. i think @error resets should be limited to the functions that actualy use it. i don't see the point in checking for @error if the function doesn't set it to 1. so why reset it to 0?

if function_doesnt_use(@error) then dont_reset(@error)

because, you don't see someone doing:

function_that_doesnt_use_@error()

if @error then ...

no? :D

Posted

Your script starts with @error = 0, so if you use this function, it will not upset @error = 0.

<{POST_SNAPBACK}>

Exactly. I don't understand how people can't understand this.
  • Administrators
Posted

this was exactly my question, thanx valik.

:idiot:

PS> i'm not sure i like this behaviour. i think @error resets should be limited to the functions that actualy use it. i don't see the point in checking for @error if the function doesn't set it to 1. so why reset it to 0?

if function_doesnt_use(@error) then dont_reset(@error)

because, you don't see someone doing:

function_that_doesnt_use_@error()

if @error then ...

no? :D

If we only reset it for functions that used it then later on if we change some function that didn't use it to use it then imagine how many scripts would break because of assumptions... You can always store the value for later:

$retval = somefunc()

$err = @error

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...