in reply to Formats and spaces to the EOL

You might pad spaces with that final character before the newline, but instead of sending that to the autodialer directly, you feed the write to a file, then read the file again and do two chops (for that final character and the newline).

Instead of a file you could also use a pipe to yourself (see the manpage of open()).