OK, xsquared and the brain got me out of my last learning crush on arrays and I'm hoping someone can help again....
I'm creating a 3d array of strings and then trying to input an unknown number of records into the specific areas from a file using strcpy to assign variables to the array values. LOST? Me too...
heres the array
21 represents the number of tables to be createdCode:char waves [21] [300] [5] [31];
300 represents the number of rows for each table
5 represents the number of columns for each table
31 represents the number of characters each string can be within the 5 columns.
heres the code on how it is used, here I am just trying to assign the input from a file recId to the rows in all 21 tables in sequence:
since arrays are new to me... I'm biting off alot. I've drawn the array out on paper to keep a visual, thats why I explain it from table point of few, can ya tell I'm reading a book????LOL!Code:ifstream fin1; fin1.open("C:\\palletperf.txt"); if (fin1.fail()) { cout <<"failed to open palletperf.txt"; } ifstream fin2; fin2.open("C:\\partnerlist.txt"); if (fin2.fail()) { cout <<"failed to open partnerlist.txt"; } //declare 3-d array waves char waves [21] [300] [5] [31]; //insert partnerlist records and poplulate all waves tables do { do { char partRow [11]; fin2>>recName; fin2>>recId; strcpy(waves[waveTableCount][partRow], recId ); }while (!fin2.eof()); fin2.close(); waveTableCount++; }while (waveTableCount <=21);
Thanks for any help-



LinkBack URL
About LinkBacks


