Siema,
mój program sypie się w linijce nr 54, proszę o pomoc.
wywala takie coś po uruchomieniu:
Unhandled exception at 0x5486ca58 (msvcr100d.dll) in test_regex.exe: 0xC0000005: Access violation writing location 0xabababab.
adres do pliku dane3.txt:
http://www.przeklej.pl/plik/dane3-txt-0029jt9u340i
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/regex.hpp>
#include <iostream>
#include <boost/foreach.hpp>
#include <fstream>
using namespace std;
using namespace boost;
int main()
{
string kod;
ifstream plik;
plik.open("dane3.txt", ios::out);
if(plik.is_open())
{
while(!plik.eof())
{
kod.push_back(plik.get());
}
}
else cout << "dupa\n";
plik.close();
const static regex email_regex(
"[.+>]([^>[:space:]<].*?)[<.+>]"
//"[.+>]([^>[:space:]<].*?)[<.+>]"
);
string *tab;
int a=0;
const sregex_token_iterator end;
for (sregex_token_iterator i(kod.begin(),
kod.end(), email_regex);
i != end;
++i)
{
tab = new string[a];
tab[a]=*i;
a++;
}
cout<< "\n\n - - - - - - - - \n\n";
system("pause");
}