General data input question (from a beginner):
I am trying to read data from a file into a data class. Each line of the data file would be it's own data object. So if I had ten lines then I would init my data object like so: DataObject* ptrDataObj = new DataObject . But how do I determine how many lines are in a file without reading through the whole file twice?
another question extremely related:
Do I have to initalize my data object to a specific size, what if I am reading from a file (such as a shape file [with multiple shapes] that has an "id" and then "n" x,y points). In java I would just use a vector, what should I do in c++ (do I HAVE to use a c++ vector)?
ex. data file: