String streams and ifstream

...and so on
The first digits are the bank account number, then first name, last name, account type, then balance. I need to read all of these into separate objects with appropriate data types. There is an abstract base class "account" and 4 derived classes for the different account types. I'm getting a memory read error. (reading at 0x000000000)

can anyone help me out here? I was in a bit of a housing crisis and missed class! I'm not sure getline is the best way to go about doing it, since according to the assignment, "[the factory class] uses that data to dynamically allocate and construct one of the derived objects based on the value of
type" so I have to pull that account type represented by the letter in front of the balance, then call the appropriate account constructor.

@DTSCode
I'm starting to wonder about you. You seem to like to make things harder for people.

@The PoloHobo
Yes, using getline() with istringstream is correct. You can omit the third argument to getline() -- it defaults to the newline character.

When using the extraction operator on a string, it scans everything until a whitespace, so account_code becomes "1234567890Fred", which is why you need to use the setw() manipulator. The fixed manipulator does nothing for you here.

BTW, it is not typically safe to use a stringstream temporary like that. More modern compilers can handle it, but I personally think I'll stick to creating a named object first: