I'm trying to read a huge txt through c++. It has 70mb. My objective is to substring line by line and generate another smaller txt containing only the information that I need.
I got to the code below to read the file. It works perfectly with smaller files, but not with the 70mb monster.
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
ifstream myReadFile;
myReadFile.open("C:/Users/Lucas/Documents/apps/COTAHIST_A2010.txt");
char output[100];
if (myReadFile.is_open()) {
while (myReadFile.eof()!=1) {
myReadFile >> output;
cout<<output;
cout<<"\n";
}
}
system("PAUSE");
return 0;
}
This is the error I get: Unhandled exception at 0x50c819bc (msvcp100d.dll) in SeparadorDeAcoes.exe: 0xC0000005: Access violation reading location 0x3a70fcbc.
If someone can point a solution in C or even in C#, that would be acceptable too!
Thanks =)