Skip to the navigation links
Last modified: December 2009

URL: http://cxc-newtest.cfa.harvard.edu/ciao4.2/stackio_stk_read_next.html
AHELP for CIAO 4.2

stk_read_next

Context: stackio

Synopsis

Returns the next element from a stack.

Syntax

String_Type stk_read_next( Stack_Type stack )

Description

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.

Example

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 );
  }

Bugs

See the bugs page for the stackio library on the CIAO website for an up-to-date listing of known bugs.

See Also

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

Last modified: December 2009