Hi!
I make a dll and its using by this tutorial. I make absolutely the same files with the same code. Ok. It works just fine. Now I add my function with #include vector, using namespace std and fstream of course:
Building a release causes no problems. Then, exactly by the author model, I add using of my function in my application.Code:DECLDIR void toFileWrite(vector<int> v, const char *fName) { ofstream inf; inf.open(fName,inf.trunc); if (inf!=NULL) { for (int i = 0; i < v.size(); i=i+2) { inf << v.at(i)<<"\t"<<v.at(i+1)<<"\n"; } } inf.close(); }
But when I call it
I got error window with text: "Unhandled exception at0x7855db75 in a.exe: Access violation reading location 0x2982d311" VS opens cpp-file of my dll and points with green arrow to line: if (inf!=NULL)Code:vector<int> a(4,100); _toFileWriteFunc(a,"hey.txt");
So, what the author didn't mention, and what I should do to make such a simple function work properly?




Reply With Quote
