Fixed an error where the program would not read output successfully.

This fixes two output-related bugs:

- An infinite loop occurred when the program attempted to read the
output from out buffer. This happened because the C-styled method used
here consisted of garbage characters that added newlines, essentially
breaking the componentsSeperatedByString method. By using C++ stream
objects, we can essentially solve this data problem.