名前空間
変種
操作

tmpnam

提供: cppreference.com
< c‎ | io

 
 
File input/output
機能します
Original:
Functions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
ファイルアクセス
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.
直接入力/出力
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
書式なし入力/出力
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.
書式付き入力/出力
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.
ファイル位置付け
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
エラー処理
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
ファイルに対する操作
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 );
一意のファイル名を作成し、filenameが指す文字列に格納します。適切な戻り値関数が一意のファイル名のTMP_MAXまで生成することが可能であるが、それらのいくつかまたはすべては、ファイルシステムの使用中であるかもしれないので、しない.
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.

目次

[編集] パラメータ

filename -
結果バッファとして使用する文字列へのポインタ。 NULLが渡された場合は、内部の静的バッファへのポインタが返されます.
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.

[編集] 値を返します

filenamefilenameNULLなかった場合。そうでなければ内部の静的バッファへのポインタが返されます。適当なファイル名を生成できない場合、NULLが返されます.
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.

[編集]

#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!

[編集] も参照してください

一時ファイルへのポインタを返します
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.

(関数) [edit]