Hi:
What operating system are you using? I have no experience with Windows/DOS, but in unix, everything is treated as a file.
In every case I've seen, you open, read, write, and close serial ports low-level, meaning you don't use the stream functions, fopen, fputs, etc.
Generally, an open is something like:
if ((lpr_fd = open("/dev/serialport", O_RDWR|O_SYNC)) == -1)
{
printf("error opening port\n"

;
exit(1);
}
Also, it depends on the hardware hooked to your port. Last year, I wrote an article on communicating with unix serial and network devices. Read it here:
Regards,
Ed