It would appear that I am encountering an unexpected overflow and I do not understand why this is occurring (much to my dismay):
Windows:
Mac:
These were both compiled using MinGW. I believe that this may be due to the difference in file types between BSD and Windows as I note that if I copy numbers.txt from a Windows OS I recieve a similar fault.
Mac error with windows file:
Mac Shell: Downloads/>$ rm numbers.txt 
# Downloaded new numbers.txt file from windows.
Mac Shell: Downloads/>$ ./Project1 
Raw output:
-----------
Segmentation fault: 11
Mac Shell: Downloads/>$
Windows with Mac file:
Code:
void do_file_magic(string file){
    string line, replace = "", numeral, dump = "", temp;
    ifstream source ("numbers.txt");
    if (!source.is_open()) {
        die_a_clean_death("Unable to open source file:", file);
    };
    // Display output to console:
    sep("Raw output:");
    // read source file and output vowels to destination file.
    while ( getline(source, line) || true) {
        dump = dump + replace;
        if ( line[0] != ' ') {
            temp = num2string(roman2num(line));
            line = remove_whitespace(line);
            replace = line + string(17-line.size(), ' ') + temp + "\n";
        // If you read this then you noticed that there was some shenagins going on.
        } else {
            numeral = num2roman(string2num(line));
            line = remove_whitespace(line);
            replace = numeral + string(17 - numeral.size(), ' ') + line + "\n";
        };
        if(source.eof()) {
            break;
        }
    };
    printf("file dump: \n%s", dump.c_str());
    // Close the files
    source.close();
    // open the file in output mode nuking everything from orbit.
    // (Its the only way to be sure)
    ofstream destination("numbers.txt");
    if (!destination.is_open()) {
        die_a_clean_death("Unable to open destination file:", file);
    };
    // Just dump a variable to the file.
    destination << dump << "\n";
    destination.close();
};
Could someone help me to understand where I am going wrong here?



 
    