I'm not a C programmer, so I'm not super clear on what's inside that pointer you're being passed in that code.
If it's a single line of a linedata report, then you could place restrictions on the position (i.e. array offset) of the characters that you're optionally replacing.
Alternately, if you're just getting a buffer of X characters, then you'd need to look for a line ending character followed immediately by the character you want to replace.
Hopefully some other folks with more experience can chime in and get you closer to a solution.
-JD.