`prevFile` is output, right? The fact that the caller passes prevFile is not relevant to this function; I'd just call this parameter `out`.

Also, could you add doxygen style documentation to all functions and data members?