tmpnam
De cppreference.com
|
|
Esta página se ha traducido por ordenador/computador/computadora de la versión en inglés de la Wiki usando Google Translate.
La traducción puede contener errores y palabras aparatosas/incorrectas. Planea sobre el texto para ver la versión original. Puedes ayudar a corregir los errores y mejorar la traducción. Para instrucciones haz clic aquí. |
| Definido en el archivo de encabezado <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.
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. |
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.
Ejemplo
Ejecuta este código
#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);
}
Salida:
Welcome to ./main_release
Called with 0 arguments
/tmp/file6HADua
Goodbye!
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) | |
Documentación de C++ para tmpnam
| |