change putc to use write
add missing ;