I'm not familiar with the c++ file streams. If you don't need the string really, it is easy:
But if you really need the string it gets trickier:Code:for (i=1; i<=10; i++) { b_file >> TempA[i] >> TempB[i]; }
Code:char Line[10][10]; // 10 strings of 10 characters each char* secNum; // pointer to the second number for (i=1; i<=10; i++) { //The code in here must input Line of file into Line[i] string b_file >> Line[i]; // the code in here must split Line[i] into TempA[i] (this is the first // number of the line) and TempB[i] (this is the second number of // the line) with " " as the delimeter TempA[i] = atoi(Line[i]); // first number secNum = strtok(Line[i], " "); // find space TempB[i] = atoi(secNum); // second number }




CornedBee
Reply With Quote