I have a vector of floating point numbers , i am trying to find out the total number of segments in the vector each containing 72 floating point numbers.I am filling the vector with the floating point numbers read from a text file.I am trying to find it from size of both the text file and the vector, would they be the same ?.And would they give the right answer.Following is the way i used This way gives me a value that is greater than the actual value , can some one help ?
long fileSizeVector;
long fileSize;
long fileSizes;
vector<float> ReplayBufferVector;
ifstream in;
in.open("fileName.txt");
if(in.is_open())
{
in.setf(ios::fixed);
in.precision(3);
in.seekg(0,ios::end);
fileSizes = in.tellg();
fileSize = fileSizes/((72)*sizeof(float));
in.seekg(0,ios::beg);
while(!in.eof())
{
for(float f;in>>f;)
ReplayBufferVector.push_back(f);
}
fileSizeVector = ReplayBufferVector.size()/72*sizeof(float);
in.close();
}