Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C++
Memory errors HELP!
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="electrixnow, post: 2544041"] I found the problem. Down in the file at the line it blows up at looks like this. 083256,,,,,,, I made that line up, but it has no data after the delimiter comma. also I found that if I put at least 2 new lines in after the last data line it also blows up. I am thinking of a way to fix. Here is my real program I am working on, disreguard the old one. ----------- #include <fstream> #include <iostream> #include <string> #include <vector> #include <ostream> #define MOVEX_QUERY "C:\\DWG_DATA\\DOCUMENTS_MOVEX.dat" #define CONTROL_LIST "C:\\DWG_DATA\\DOCUMENTS_LIST.txt" #define REQUEST_LIST "C:\\DWG_DATA\\REQUEST_LIST.txt" using namespace std; typedef vector<string> stringvec; void upper_case(string in, stringvec &out) { // Erase all entries from the vector out.swap(stringvec()); int len = in.length(); for (int a=0; a<len; ++a) in[a] = toupper(in[a]); out.push_back(in); } int main() { char * document; char * edition; char input_line[31]; char * next_token1; int i=0; ifstream inf(MOVEX_QUERY); ifstream inf2(CONTROL_LIST); ofstream outf(REQUEST_LIST); if (inf) { while ((inf.getline(input_line,30)) != NULL) { //while (! inf.eof()) // eof did'nt work //inf.getline(input_line,30); // don't know why document = strtok_s( input_line, " ,\t\n", &next_token1); edition = strtok_s( NULL, " ,\t\n", &next_token1); stringvec doc,edi; upper_case(document,doc); upper_case(edition,edi); cout << "vector document " << doc[0] <<'\n'; // for test cout << "vector edition " << edi[0] <<'\n'; // for test cout << i <<'\n'; // for test if ( doc[0] == edi[0] ) { if (! outf) { cout << "File " << REQUEST_LIST; cout << " could not be opened."; return -1; } outf << doc[0]<<","<< edi[0]<< endl; } ++i; } } else { cout << "File " << MOVEX_QUERY; cout << " could not be opened."; return 1; } outf.close(); cout << "PROCESSING COMPLETE\n"; return 0; } ----------- Here is a short data test file I made. I won't work on the last line. 526104A, 526104a 526105-3, C 526106-ir ,D 526107-ap,, [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C++
Memory errors HELP!
Top