tmpnam
De cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
| Defined in header <stdio.h>
|
||
| char *tmpnam( char *filename ); |
||
Crea un nombre de archivo único y lo almacena en la cadena de caracteres apuntada por
filename. La función es capaz de generar hasta TMP_MAX de nombres de archivo único, pero algunos o todos ellos pueden estar en uso en el sistema de ficheros y por lo tanto no los valores adecuados de retorno . Original:
Creates an unique filename and stores it in character string pointed to by
filename. The function is capable of generating up to TMP_MAX of unique filenames, but some or all of them may be in use in the filesystem and thus not suitable return values. The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Contenido |
[editar] Parámetros
| filename | - | puntero a la cadena de caracteres que se utiliza como un tampón de resultado. Si
NULL se pasa, un puntero a un buffer estático interno se devuelve .Original: pointer to the character string to be used as a result buffer. If NULL is passed, a pointer to an internal static buffer is returned.The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[editar] Valor de retorno
filename si filename no era NULL. De lo contrario un puntero a un buffer estático interno se devuelve. Si no hay ningún nombre de archivo adecuado puede ser generado, NULL se devuelve .Original:
filename if filename was not NULL. Otherwise a pointer to an internal static buffer is returned. If no suitable filename can be generated, NULL is returned.The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
[editar] Ejemplo
#include <stdlib.h> #include <stdio.h> #include <stdint.h> #include <stdbool.h> int main(int argc, char *argv[]) { printf("Welcome to %s\n", argv[0]); printf("Called with %u arguments\n", argc - 1); char buffer[L_tmpnam] = {'\0'}; tmpnam(buffer); printf(buffer); printf("\n"); printf("Goodbye!\n"); exit(EXIT_SUCCESS); }
Output:
Welcome to ./main_release Called with 0 arguments /tmp/file6HADua Goodbye!
[editar] Ver también
| devuelve un puntero a un archivo temporal Original: returns a pointer to a temporary file The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (función) | |
| C++ documentation for tmpnam
| |