sigio

I want to receive data CONTINUOUSLY from a COM port & simultaneously want to write to file

I want to read serial COM port and to write the data to a file in LINUX. Actually I'm sending data from hyperterminal from other PC. The problem is without while loop I can write only one line. But with while(1) loop I can't write anything to file. Or else I have to send BIG file, then application exits/terminates and writes to the fi...