I want to use the printf() to print characters on LCD, via serial port, 7-segment. I want to change this in runtime.
My idea was to change the member "handle" of stdout during runtime. In the function fputc(), I can call the correct routines using a switch(f->handle) statement.
I modified the __stdout as follows.
struct __FILE { int handle; /* Add whatever you need here */ }; FILE __stdout; #define LCD 1 #define RS232 2 #define SEVENSEGMENT 3 void main(void) { stdout->handle = LCD; printf("TEST"); } int fputc(int ch, FILE *f) { switch (f->handle) { case .. case .. } return (ch); }
I got the error "pointer to incomplete classtype is not allowed.
What 's wrong with this ?
Luc.