您的位置:首页 > 其它

把数据连续的输入到一个文件夹中

2015-12-10 16:15 381 查看
#include <fstream>

#include <string>

#include <iostream>

//using namespace std;

//

//void Createflile();

//void Readflie();

//void main()

//{
/*int cnt = 0;
string str;

ifstream fin("C:\\ds\\log.txt", ios::in);
if (!fin){
printf("The file is not exist!");
}
while (getline(fin, str))
{

cnt++;
cout << str << endl;*/

#include<iostream> 

 #include<vector>
using namespace std;

int main()

{

char* path = "C:\\ds\\log.txt";
fstream  _file;
_file.open("C:\\ds\\log.txt", ios::in);
if (_file)
{
std::cout << "已经创建了"<< std::endl;
//_file >> "sda" >> endl;
ofstream fout(path, ios::app);
for (size_t i = 0; i < 3; i++)
{
fout << "asdsad" << endl;
}

}
else
{
ofstream fout(path);
for (size_t i = 0; i < 3; i++)
{
fout << "asdsad" << endl;
}
fout.close();
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  输入流