Returns the next element from a stack.
String_Type stk_read_next( Stack_Type stack )
This routine returns the next element in the stack
and increases the current position by 1.
If the end of the stack is reached - so that the value
returned by stk_current() equals that returned by
stk_count() then the pointer is not advanced and NULL
is returned.
The stk_read_num() routine provides a means to read the
the stack contents without changing the current position
of the stack.
The following example shows you one way to loop through
all the elements in a stack.
See the ahelp page for stk_read_num() for another way to do this.
stk_rewind( stk );
loop ( stk_count(stk) ) {
variable elem = stk_read_next( stk );
vmessage( "Stack: %s", elem );
}
The function now returns NULL when called at the end of a stack rather than causing an "Intrinsic Error".
- modules
-
stackio
- stackio
-
stk_append,
stk_build,
stk_change_current,
stk_change_num,
stk_close,
stk_count,
stk_current,
stk_delete_current,
stk_delete_num,
stk_disp,
stk_expand_n,
stk_read_num,
stk_rewind,
stk_set_current
|