I have a piece of code that reads a file line by line and then it stores two corresponding binary representations in two vectors. But the size of vectors and the total number of lines processed are zero.
int numLines = 319426908; // calculated before for loop
char temp[100];
vector<long long int> p1, p2;
long long int c = 0;
#pragma omp parallel for schedule(dynamic) shared(c, p1, p2, fp) private(temp)
for(int i=0; i<numLines; i++){
if(fgets(temp, 100, fp) != NULL){
temp[strlen(temp)-1] = '\0';
long long int *A = toLongLong(temp);
p1.push_back(A[0]);
p2.push_back(A[1]);
c++;
}
}
cout << "Completed ...c = " << c << endl;
cout << "p1.size: " << p1.size() << " p2.size: " << p2.size() << endl;
This is the output
Completed ...c = 0
p1.size: 0 p2.size: 0
Where am I going wrong in the above piece of code?