<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <HTML> <HEAD> <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9"> <TITLE> S-Lang Run-Time Library Reference: Version 1.4.0: Functions that parse pathnames</TITLE> <LINK HREF="slangfun-14.html" REL=next> <LINK HREF="slangfun-12.html" REL=previous> <LINK HREF="slangfun.html#toc13" REL=contents> </HEAD> <BODY> <A HREF="slangfun-14.html">Next</A> <A HREF="slangfun-12.html">Previous</A> <A HREF="slangfun.html#toc13">Contents</A> <HR> <H2><A NAME="s13">13. Functions that parse pathnames</A></H2> <P> <H2><A NAME="path_basename"></A> <A NAME="ss13.1">13.1 <B>path_basename</B></A> </H2> <P> <DL> <DT><B> Synopsis </B><DD><P>Get the basename part of a pathname <DT><B> Usage </B><DD><P><CODE>String_Type path_basename (String_Type path)</CODE> <DT><B> Description </B><DD><P>The <CODE>path_basename</CODE> function returns the basename associated with the <CODE>path</CODE> parameter. The basename is the non-directory part of the filename, e.g., on unix <CODE>c</CODE> is the basename of <CODE>/a/b/c</CODE>. <DT><B> See Also </B><DD><P><CODE>path_dirname, path_extname, path_concat, path_is_absolute</CODE> </DL> <P> <P> <H2><A NAME="path_concat"></A> <A NAME="ss13.2">13.2 <B>path_concat</B></A> </H2> <P> <DL> <DT><B> Synopsis </B><DD><P>Combine elements of a pathname <DT><B> Usage </B><DD><P><CODE>String_Type path_concat (String_Type dir, String_Type basename)</CODE> <DT><B> Description </B><DD><P>The <CODE>path_concat</CODE> function combines the arguments <CODE>dir</CODE> and <CODE>basename</CODE> to produce a pathname. For example, on unix is <CODE>dir</CODE> is <CODE>x/y</CODE> and <CODE>basename</CODE> is <CODE>z</CODE>, then the function will return <CODE>x/y/z</CODE>. <DT><B> See Also </B><DD><P><CODE>path_dirname, path_basename, path_extname, path_is_absolute</CODE> </DL> <P> <P> <H2><A NAME="path_dirname"></A> <A NAME="ss13.3">13.3 <B>path_dirname</B></A> </H2> <P> <DL> <DT><B> Synopsis </B><DD><P>Get the directory name part of a pathname <DT><B> Usage </B><DD><P><CODE>String_Type path_dirname (String_Type path)</CODE> <DT><B> Description </B><DD><P>The <CODE>path_dirname</CODE> function returns the directory name associated with a specified pathname. <DT><B> Notes </B><DD><P>On systems that include a drive specifier as part of the pathname, the value returned by this function will include the driver specifier. <DT><B> See Also </B><DD><P><CODE>path_basename, path_extname, path_concat, path_is_absolute</CODE> </DL> <P> <P> <H2><A NAME="path_extname"></A> <A NAME="ss13.4">13.4 <B>path_extname</B></A> </H2> <P> <DL> <DT><B> Synopsis </B><DD><P>Return the extension part of a pathname <DT><B> Usage </B><DD><P><CODE>String_Type path_extname (String_Type path)</CODE> <DT><B> Description </B><DD><P>The <CODE>path_extname</CODE> function returns the extension portion of a specified pathname. If an extension is present, this function will also include the dot as part of the extension, i.e., if <CODE>path</CODE> is <CODE>file.c</CODE>, then this function returns <CODE>".c"</CODE>. If no extension is present, the function returns an empty string <CODE>""</CODE>. <DT><B> Notes </B><DD><P>Under VMS, the file version number is not returned as part of the extension. <DT><B> See Also </B><DD><P><CODE>path_sans_extname, path_dirname, path_basename, path_concat, path_is_absolute</CODE> </DL> <P> <P> <H2><A NAME="path_is_absolute"></A> <A NAME="ss13.5">13.5 <B>path_is_absolute</B></A> </H2> <P> <DL> <DT><B> Synopsis </B><DD><P>Determine whether or not a pathname is absolute <DT><B> Usage </B><DD><P><CODE>Int_Type path_is_absolute (String_Type path)</CODE> <DT><B> Description </B><DD><P>The <CODE>path_is_absolute</CODE> function will return non-zero is <CODE>path</CODE> refers to an absolute pathname, otherwise it returns zero. <DT><B> See Also </B><DD><P><CODE>path_dirname, path_basename, path_extname, path_concat</CODE> </DL> <P> <P> <H2><A NAME="path_sans_extname"></A> <A NAME="ss13.6">13.6 <B>path_sans_extname</B></A> </H2> <P> <DL> <DT><B> Synopsis </B><DD><P>Strip the extension from a pathname <DT><B> Usage </B><DD><P><CODE>String_Type path_sans_extname (String_Type path)</CODE> <DT><B> Description </B><DD><P>The <CODE>path_sans_extname</CODE> function removes the file name extension (including the dot) from the path and returns the result. <DT><B> See Also </B><DD><P><CODE>path_extname, path_basename, path_dirname, path_concat</CODE> </DL> <P> <P> <P> <HR> <A HREF="slangfun-14.html">Next</A> <A HREF="slangfun-12.html">Previous</A> <A HREF="slangfun.html#toc13">Contents</A> </BODY> </HTML>