Espaços nominais
Variantes
Acções

tmpnam

Da cppreference.com
< c‎ | io

 
 
File input/output
Funções
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Arquivo de acesso
Original:
File access
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Directa de entrada / saída
Original:
Direct input/output
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
fread
fwrite
Não formatado entrada / saída
Original:
Unformatted input/output
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Formatado de entrada / saída
Original:
Formatted input/output
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Arquivo de posicionamento
Original:
File positioning
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ftell
fgetpos
fseek
fsetpos
rewind
De tratamento de erros
Original:
Error handling
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
clearerr
feof
ferror
perror
Operações em arquivos
Original:
Operations on files
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
remove
rename
tmpfile
tmpnam
 
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.

Í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.

[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) [edit]