tmpnam
Da 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 ); |
||
Cria um nome de arquivo único e as armazena em cadeia de caracteres apontada por
filename. A função é capaz de gerar até TMP_MAX de nomes de ficheiros originais, mas alguns ou todos eles podem ser utilizados para o sistema de ficheiros e, portanto, não retornam valores adequados. 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.
Índice |
[editar] Parâmetros
| filename | - | ponteiro para a cadeia de caracteres a ser utilizado como um buffer de resultado. Se
NULL é passado, um ponteiro para um buffer interno estático é retornado .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 se filename não era NULL. Caso contrário, um ponteiro para um buffer interno estático é retornado. Se nenhum nome adequado pode ser gerado, NULL é retornado.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] Exemplo
#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] Veja também
| retorna um ponteiro para um arquivo temporário 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. (função) | |
| C++ documentation for tmpnam
| |