Capturing Serial Console output in a file


I am running a QNX6 OS and writing some applications over that.
The printf() call in my application outputs the message over serial console /dev/ser1 which is connected with a hyperterminal ( Baud rate 115200 ).
I wanted to capture the complete output text coming over serial console , irrespective of any application. The purpose is to capture the output so that any crash message ( which is dump by default on serial console ) is captured in a file, and can be seen later.

I have used following code into my file

con=open("/dev/ser1",O_RDWR | O_NOCTTY | O_NDELAY| O_NONBLOCK);
printf(“Read :%s”,buff);



The problem in this approach is that i can only read the characters which
are being entered by a user but not the characters which are coming on the
output buffer.

Could somebody give a hint which API to look for getting complete buffer associated with /dev/ser1 and to get notification whenever something comes on the output buffer ( trying luck with ionotify() currently !)