namespace std {
int fprintf( FILE* stream, const char* format, ... );
}
概要
指定されたファイルストリームに、指定された書式文字列を使用してデータを出力する。
例
#include <cstdio>
int main() {
int n = 123;
std::fprintf(stdout, "Hello, World!\n%d\n", n);
const char* path = "test.txt";
std::FILE* fp = std::fopen(path, "w");
std::fprintf(fp, "Hello, World!\n%d\n", n);
std::fclose(fp);
}
出力
Hello, World!
123
ファイル出力(test.txt)
Hello, World!
123
処理系
- Clang: ??
- GCC: ??
- Visual C++: ??