Potresti usare serial.h, nello stesso sito si trova anche serial.c che ne mostra l'utilizzo.