[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   XPtempName()
   Return name for a Temporary file
------------------------------------------------------------------------------

   Function:   XPtempName()

               This function uses a DOS call to create a file that is
               truly unique. You can be sure that the file name can be
               used by your application without bothering if you have
               overwritten another file (from another user). It's an easy
               way to overcome well known network problems. The functions are
               not network specific, and work in any situation (standalone,
               any network (should)).

               Contrary to XPuniqName(), you have control over the name of
               the Temporary file to create. Theoretically, this function
               could loop (when you have created 9999 files with same prefix
               and extension!), or take some time to finish when a number of
               users is attempting to create the Temporary file. In such
               cases use of UniqName() is recommended.

   Syntax:     XPtempName([cDir][,cPrefix][,cExt]],nAttrib]) --> cTmpName

   Arguments:  <cDir> is the directory to create the file, it
               defaults to current directory. <cPrefix> may be a prefix
               (up to 4 characters) for the file name, the remaining 4
               characters are used by the function to create the Temp file.
               <cPrefix> defaults to "TEMP". <cExt> is an extension that can
               be supplied, it defaults to "$$$". nAttrib is optionnal and
               indicates the Attribute of the file to create, it defaults
               to 0.

               Note that the setting of SET TEMP or SET TMP is completely
               ignored. You may choose to use by using GetEnv('TEMP')
               yourself.

   Returns:    the Name of the temporary file, or "" when an Error
               occured. In case of Error, inspect to XPferror()
               to see what the error was. Possibly Acces denied (5),
               or Path not found (3), for instance.

               The name of the file returned is of the form:

               DIR\PREFnnnn.EXT

               where DIR is the directory (when supplied), PREF
               is the prefix one supplied and EXT the extension.
               nnnn is a number and based on Seconds() times 100.

               The file created is closed (zero lengtgh), and can be safely
               used by your application. It's name is thus returned.
               Use XPfcreateNew() when you want the file to remain open.

   Usage:      cTmpName := XPtempName('','COPY','DBF')
               if !empty(cTmpName)
                  Copy to (cTmpName)....
               end

See Also: XPuniqName()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson