I have changed buffer from a char array to a string, seems to make things a bit simpler.
You'll find that the String class uselessly pisses away resources. It is NOT necessary. People wrote text processing applications in C for 30 years before C++ came along.
Any downsides to this I should be aware of?
Well, maybe a few...