This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

owerride function problem in keil

Hi,
I used printf for serial print by this function:

struct __FILE { int handle;} ;
//FILE __stdout;
//FILE __stdin;
//FILE __stderr;

int fputc(int ch, FILE *f)
{ while(!USART_GetFlagStatus(COM3,USART_FLAG_TXE));

USART_SendData(COM3,ch);

return ch;
}

This worked but when I want to create a file and write on it with fwrite function, data send to serial!! How can I tell to micro fwrite don't use my fputc function and write data to file not serial?
When I remove my fputc function, data write to file but I want to use printf for debug and I don't want to remove it.

I hope I've been able to figure out what I mean.

Regards,
Alireza

Parents Reply Children