Difference between revisions of "Os.tmpname"
From GiderosMobile
Line 2: | Line 2: | ||
'''Available since:''' Gideros 2011.6<br/> | '''Available since:''' Gideros 2011.6<br/> | ||
=== Description === | === Description === | ||
− | Returns a string with a file name that can be used for a temporary file. The file must be explicitly opened before its use and explicitly removed when no longer needed. | + | <translate>Returns a string with a file name that can be used for a temporary file. The file must be explicitly opened before its use and explicitly removed when no longer needed. |
On some systems (POSIX), this function also creates a file with that name, to avoid security risks. (Someone else might create the file with wrong permissions in the time between getting the name and creating the file.) You still have to open the file to use it and to remove it (even if you do not use it). | On some systems (POSIX), this function also creates a file with that name, to avoid security risks. (Someone else might create the file with wrong permissions in the time between getting the name and creating the file.) You still have to open the file to use it and to remove it (even if you do not use it). | ||
− | When possible, you may prefer to use | + | When possible, you may prefer to use [[[io.tmpfile]]], which automatically removes the file when the program ends.</translate> |
<source lang="lua"> | <source lang="lua"> | ||
(string) = os.tmpname() | (string) = os.tmpname() | ||
</source> | </source> | ||
=== Return values === | === Return values === | ||
− | '''Returns''' (string) name for the temporary file<br/> | + | '''Returns''' (string) <translate>name for the temporary file</translate><br/> |
Revision as of 13:38, 23 August 2018
Available since: Gideros 2011.6
Description
Returns a string with a file name that can be used for a temporary file. The file must be explicitly opened before its use and explicitly removed when no longer needed.
On some systems (POSIX), this function also creates a file with that name, to avoid security risks. (Someone else might create the file with wrong permissions in the time between getting the name and creating the file.) You still have to open the file to use it and to remove it (even if you do not use it).
When possible, you may prefer to use [[[io.tmpfile]]], which automatically removes the file when the program ends.
(string) = os.tmpname()
Return values
Returns (string) name for the temporary file