not sure why I'm getting a seg fault all I'm attempting to do is type out a file. Basically have each char of the file typed out one after the other. I feel like it has something to do with my 4 loop index going to far.
the function readandtype() is defined as returning a string. But no value is returned from the function.
If it doesn't need to return anything, make the type void instead of string. Or if you did want to return something, make sure the function will always return a value, e.g. add return""; at line 28.
Also - though not the cause of the seg fault, don't loop on eof(). Instead put the actual input operation as the loop condition.
Minor comment. Instead of this inside the for loop,