/*使用I/O流以文本方式建立一个文件test1.txt,
写入字符“已成功写入文件1!”,用其他字处理
程序打开,看看是否正确*/
#include <iostream>
#include <sstream>
#include <fstream>
#include <string.h>
using namespace std;
int main()
{
const char c[16] = "已成功写入文件!";
ofstream file("text1.txt", ios_base::binary);
file.write(c, sizeof(c));
file.close();
return 0;
}
file << c
这样看看呢
另外
text1.txt
删除掉,再运行程序