<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <HTML> <HEAD> <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9"> <TITLE> {The S-lang C Library Reference}: SLang_pop_slstring</TITLE> <LINK HREF="cref-72.html" REL=next> <LINK HREF="cref-70.html" REL=previous> <LINK HREF="cref.html#toc71" REL=contents> </HEAD> <BODY> <A HREF="cref-72.html">Next</A> <A HREF="cref-70.html">Previous</A> <A HREF="cref.html#toc71">Contents</A> <HR> <H2><A NAME="SLang_pop_slstring"></A> <A NAME="s71">71. <B>SLang_pop_slstring</B></A></H2> <P> <DL> <DT><B> Synopsis </B><DD><P>Pop a hashed string from the stack <DT><B> Usage </B><DD><P><CODE>int SLang_pop_slstring (char **s_ptr)</CODE> <DT><B> Description </B><DD><P>The <CODE>SLang_pop_slstring</CODE> function pops a hashed string from the <B>S-lang</B> run-time stack and returns it via <CODE>s_ptr</CODE>. It returns zero if successful, or <CODE>-1</CODE> upon failure. The resulting string should be freed via a call to <CODE>SLang_free_slstring</CODE> after use. <DT><B> Example </B><DD><P> <BLOCKQUOTE><CODE> <PRE> void print_string (void) { char *s; if (-1 == SLang_pop_slstring (&s)) return; fprintf (stdout, "%s\n", s); SLang_free_slstring (s); } </PRE> </CODE></BLOCKQUOTE> <DT><B> Notes </B><DD><P><CODE>SLang_free_slstring</CODE> is the preferred function for popping strings. This is a result of the fact that the interpreter uses hashed strings as the native representation for string data. <P>One must <EM>never</EM> free a hashed string using <CODE>free</CODE> or <CODE>SLfree</CODE>. In addition, one must never make any attempt to modify a hashed string and doing so will result in memory corruption. <DT><B> See Also </B><DD><P><CODE>SLang_free_slstring, SLpop_string</CODE> </DL> <P> <P> <HR> <A HREF="cref-72.html">Next</A> <A HREF="cref-70.html">Previous</A> <A HREF="cref.html#toc71">Contents</A> </BODY> </HTML>