Skip to the navigation links
Last modified: December 2009

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

stk_current

Context: stackio

Synopsis

Returns the current position of the stack.

Syntax

Integer_Type stk_current( Stack_Type stack )

Description

This routine returns the current position within a stack. This position determines the element returned by calls to stk_read_next().

When a stack is created, the current position is set to 0 and it is increased by 1 each time stk_read_next() is called. The position can also be changed by the skt_set_current() and stk_rewind() functions.

Example

if ( stk_current(stk) == stk_count(stk) ) stk_rewind(stk);

This code will reset the stack to its start position, by calling stk_rewind(), if it has reached the end of the stack.

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_delete_current, stk_delete_num, stk_disp, stk_expand_n, stk_read_next, stk_read_num, stk_rewind, stk_set_current

Last modified: December 2009