Skip to the navigation links
Last modified: December 2009

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

stk_read_num

Context: stackio

Synopsis

Returns the selected element from a stack.

Syntax

String_Type stk_read_num( Stack_Type stack, Integer_Type N )

Description

Return the character string from a stack in position N. The first item in the stack is assigned the number "1", and sequentially thereafter. NULL is returned if any errors were encountered or if the requested entry was outside the range of the stack.

This function does not change the current position of the stack - i.e. that used by routines like stk_read_next(), stk_set_current(), and stk_rewind().

Example

The following example shows you one way to loop through all the elements in a stack. See the ahelp page for stk_read_next() for another way to do this.

  _for ( 1, stk_count(stk), 1 ) {
    variable i = ();
    variable elem = stk_read_num( stk, i );
    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_next, stk_rewind, stk_set_current

Last modified: December 2009