1. 程式人生 > 其它 >向檔案中寫入字串

向檔案中寫入字串

技術標籤:筆記

#include<iostream>
using namespace std;
#include<fstream>
int main()
{
	char s[100];
	gets(s);
	ofstream fout("字串.txt");
	if(!fout){
		cout<<"檔案開啟失敗!"<<endl;
		return 0;
	}
	else{
		fout<<s<<endl;
	}
	return 0;
}