<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<TITLE> {The S-lang C Library Reference}: SLpop_string</TITLE>
<LINK HREF="cref-70.html" REL=next>
<LINK HREF="cref-68.html" REL=previous>
<LINK HREF="cref.html#toc69" REL=contents>
</HEAD>
<BODY>
<A HREF="cref-70.html">Next</A>
<A HREF="cref-68.html">Previous</A>
<A HREF="cref.html#toc69">Contents</A>
<HR>
<H2><A NAME="SLpop_string"></A> <A NAME="s69">69. <B>SLpop_string</B></A></H2>

<P>
<DL>
<DT><B> Synopsis </B><DD><P>Pop a string from the stack
<DT><B> Usage </B><DD><P><CODE>int SLpop_string (char **strptr);</CODE>
<DT><B> Description </B><DD><P>The <CODE>SLpop_string</CODE> function pops a string from the stack and
returns it as a malloced pointer.  It is up to the calling routine
to free this string via a call to <CODE>free</CODE> or <CODE>SLfree</CODE>.  If
successful, <CODE>SLpop_string</CODE> returns zero.  However, if the top
stack item is not of type <CODE>SLANG_STRING_TYPE</CODE>, or the stack is
empty, the function will return <CODE>-1</CODE> and set
<CODE>SLang_Error</CODE> accordingly.
<DT><B> Example </B><DD><P>
<BLOCKQUOTE><CODE>
<PRE>
      define print_string (void)
      {
         char *s;
         if (-1 == SLpop_string (&amp;s))
           return;
         fputs (s, stdout);
         SLfree (s);
      }
</PRE>
</CODE></BLOCKQUOTE>
<DT><B> Notes </B><DD><P>This function should not be confused with <CODE>SLang_pop_slstring</CODE>,
which pops a <EM>hashed</EM> string from the stack.
<DT><B> See Also </B><DD><P><CODE>SLang_pop_slstring. SLfree</CODE>
</DL>
<P>
<P>
<P>
<HR>
<A HREF="cref-70.html">Next</A>
<A HREF="cref-68.html">Previous</A>
<A HREF="cref.html#toc69">Contents</A>
</BODY>
</HTML>
