Best Answer - Chosen by Asker
TempString is uninitialized, so when file.getline() tries to write where it points . . . segfault.
As far as why file.tellg() would segfault after fixing that (as you mentioned in your other question), I don't know, especially not seeing how line is declared (as an int perhaps?). Maybe you should check that file is still good() before callint file.tellg again? Although offhand I don't know how a getline call would cause it to no longer be good().
- Asker's Rating:
- Asker's Comment:
- Thank you very much (for both questions). If I ask the question a little bit later, I'll be sure to include the updated code.