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: 2544036"] I have changed the code and it still blows up at 182 lines I found that if I comment out the two string lines noted that it runs to 19000 + lines. [email]int2str@gmail.com[/email] suggested I was pushing it with the array size but it works fine. I the array is full with no error after the while statement. Any clue? and I am mixing C and C++ because have just started using C++ with VC++ Express, it was free, and I have not found a good online C++ reference. I use to program in C type shell languages in the 80's. So I need a good online or electronic VC++ reference library. or hardback would work, any suggestions are welcome. Thanks for the help thus far. #include <fstream> #include <iostream> #include <string> #define MOVEX_QUERY "C:\\DWG_DATA\\DOCUMENTS_movex.csv" // int main(){ char * document; char * edition; char * str1; char * next_token1; int lines=0; using namespace std; ifstream inf(MOVEX_QUERY); if (inf) { char namn[20000][30]; while (lines < 20000 && (inf.getline(namn[lines], 30)) != NULL)++lines; for (int i = 0; i < lines; ++i){ str1 = namn[i]; cout << str1 << '\n'; document = strtok_s( str1, " ,\t\n", &next_token1); edition = strtok_s( NULL, " ,\t\n", &next_token1); // string doc(document); // if these two lines are removed // string edi(edition); // it will run to 19000 + lines printf( "%s\n", document ); printf( "%s\n", edition ); cout << i <<'\n'; } } else { cout << "Could not open file\n"; return 1; } cout << "PROCESSING COMPLETE\n"; return 0; } Here is a sample of the data being input. 00-00008RA,0004,,,,,, 00-00009RA,0003,,,,,, 00-00010RA,0003,,,,,, 00-00019RA,0005,,,,,, 00-00021RA,0016,,,,,, 00-00036RA,0016,,,,,, 00-00041RA,0005,,,,,, 00-00042RA,0009,,,,,, 00-00043RA,0003,,,,,, 00-00045RA,0008,,,,,, 00-00047RA,0018,,,,,, 00-00051RA,0018,,,,,, 00-00052RA,0029,,,,,, 00-00054RA,0028,,,,,, 00-00055RA,0023,,,,,, 00-00056RA,0006,,,,,, 00-00057RA,0008,,,,,, 00-00058RA,0005,,,,,, 00-00059RA,0005,,,,,, 00-00076RA,0006,,,,,, 00-00085RA,0025,,,,,, 00-00086RA,0025,,,,,,[/i] [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C++
Memory errors HELP!
Top