trying to pull text from our teachers text file but having issues doing so. its a char type. getline wont work, i tried making a temp array to pull the info as a string and i couldnt get that to work either. i was trying to use strcopy as well and couldnt get it to work either. i must be doing something wrong any hints or suggestions ive been stuck on this part for a whillllee
also im referring to the 2nd for loop. everything else works fine.
1 2 3 4 5 6 7 8 9 10 11 12 13
void fillArray(string n[], char eid[][6], double w[], int us[], int size){
ifstream file;
file.open("C:\\classdata\\salesdata.txt");
for (int i=0; i< 20; i++){
getline(file, n[i]);
}
for (int i =0; i < 20; i++){
strcopy(eid[i], file, 6)
}
the text file is with 20 entries for each type
John. B
Guy. A
...
a1253
a2736
b8293
...
16.96
16.96
19.21
i just went ahead and did this... it makes it into a two dimnesional array which will cause other issues with my other functions i think? I dont think im suppose to turn it into a two dim array but then again arent all char arrays two dim? its programming one and i dont know.
for (int i = 0; i < 20; i++){
for (int j = 0; j < 5; j++){
file >> eid[i][j];
}
}
when i sent it to the display function.... lol feel like its a real bootleg way to do it