<HTML><HEAD><TITLE>Tcl Library Procedures - Tcl_TranslateFileName manual page</TITLE></HEAD><BODY> <H3><A NAME="M2">NAME</A></H3> Tcl_TranslateFileName - convert file name to native form and replace tilde with home directory <H3><A NAME="M3">SYNOPSIS</A></H3> <B>#include <tcl.h></B><BR> char *<BR> <B>Tcl_TranslateFileName</B>(<I>interp</I>, <I>name</I>, <I>bufferPtr</I>)<BR> <H3><A NAME="M4">ARGUMENTS</A></H3> <DL> <P><DT><A HREF="../TclLib/Interp.htm">Tcl_Interp</A> <B>*interp</B> (in)<DD> Interpreter in which to report an error, if any. <P><DT>char <B>*name</B> (in)<DD> File name, which may start with a ``~''. <P><DT>Tcl_DString <B>*bufferPtr</B> (in/out)<DD> If needed, this dynamic string is used to store the new file name. At the time of the call it should be uninitialized or empty. The caller must eventually call <B><A HREF="../TclLib/DString.htm">Tcl_DStringFree</A></B> to free up anything stored here. <P></DL> <H3><A NAME="M5">DESCRIPTION</A></H3> This utility procedure translates a file name to a form suitable for passing to the local operating system. It converts network names into native form and does tilde substitution. <P> If <B>Tcl_TranslateFileName</B> has to do tilde substitution or translate the name then it uses the dynamic string at <I>*bufferPtr</I> to hold the new string it generates. After <B>Tcl_TranslateFileName</B> returns a non-NULL result, the caller must eventually invoke <B><A HREF="../TclLib/DString.htm">Tcl_DStringFree</A></B> to free any information placed in <I>*bufferPtr</I>. The caller need not know whether or not <B>Tcl_TranslateFileName</B> actually used the string; <B>Tcl_TranslateFileName</B> initializes <I>*bufferPtr</I> even if it doesn't use it, so the call to <B><A HREF="../TclLib/DString.htm">Tcl_DStringFree</A></B> will be safe in either case. <P> If an error occurs (e.g. because there was no user by the given name) then NULL is returned and an error message will be left at <I>interp->result</I>. When an error occurs, <B>Tcl_TranslateFileName</B> frees the dynamic string itself so that the caller need not call <B><A HREF="../TclLib/DString.htm">Tcl_DStringFree</A></B>. <P> The caller is responsible for making sure that <I>interp->result</I> has its default empty value when <B>Tcl_TranslateFileName</B> is invoked. <H3><A NAME="M6">SEE ALSO</A></H3> <B><A HREF="../TclCmd/filename.htm">filename</A></B> <H3><A NAME="M7">KEYWORDS</A></H3> <A href="../Keywords/F.htm#file name">file name</A>, <A href="../Keywords/H.htm#home directory">home directory</A>, <A href="../Keywords/T.htm#tilde">tilde</A>, <A href="../Keywords/T.htm#translate">translate</A>, <A href="../Keywords/U.htm#user">user</A> <HR><PRE> <A HREF="../copyright.htm">Copyright</A> © 1989-1993 The Regents of the University of California. <A HREF="../copyright.htm">Copyright</A> © 1994-1996 Sun Microsystems, Inc. <A HREF="../copyright.htm">Copyright</A> © 1995-1997 Roger E. Critchlow Jr.</PRE> </BODY></HTML>