I feel like I'm completely missing out on something but my compiler shows absolutely nothing when i test out if my array is getting filled with values from the txt file.
void orderID(){
ifstream result;
int flag;
int loop = 0;
string temp;
string line;
string myArray[flag];
result.open("resultat.txt");
while(getline(result, line)){
flag++; //number of lines in file
}
result.close();
result.open("resultat.txt");
while(getline(result, line)){
myArray[loop] = line;
loop++;
cout<< myArray[1];
}
result.close();
}
Should probably post the txt file im testing. It should work with any file though.
21 para 21 first
23 dyta 23 second
11 katert 11 fourth
12 pest 12 fifth
13 fundit 13 last
14 jojo 14 nono
Anyone knows what I'm missing here? Btw please do not suggest vectors as I can not use them for this scenario. And yes I am calling the function from int main.