
26.12.2009, 16:27
|
|
Участник форума
Регистрация: 07.07.2008
Сообщений: 161
С нами:
9391926
Репутация:
234
|
|
Сообщение от Дикс
открываю файл
ifstream fin("file.txt");
копирую его в вектор, типа string
copy(istream_iterator<string>(fin), istream_iterator<string>(), back_inserter(vect));
получаю вектор в котором файл разбит на элементы по ПРОБЕЛАМ
как сделать так, чтобы он разбивал по переводам строк?
PHP код:
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
using namespace std;
int main()
{
ifstream fin("input.txt");
vector <string> v;
string tmp;
while (getline(fin, tmp))
{
v.push_back(tmp);
cout << tmp << "\n";
}
cin.get();
return 0;
}
|
|
|