Hi I wonder if it is possible the get the source code for the function "strstr.c" I need to modify it to call my watchdog. /ingvar
"Is it possible to get the source code of printf too ?" See: http://www.keil.com/forum/docs/thread5382.asp "I want to modify it to add a new parameter wich indicates the printer device " This has been discussed before - try a search. It might be easier to write your own function that does the "extras," and use sprintf to do the formatting?
Hi Andrew, Supose you want to write to a device that is not ready, like a printer. It would be great to have an abort/retry mechanism otherwise the microcontroller get stuck untill the printer is ready. I tried to do something in putchar but it seems to be dificult to abort from putchar because it is called from printf. Any idea ? Regards Viktor
"it seems to be dificult to abort from putchar because it is called from printf." What's the difficulty? Remember, printf on PCs etc does exactly that! You don't have a different printf for each possible output device (screen, printer, whatever) - printf just does itself and leaves it to the lower layers to sort themselves out with aborts, retries, etc, etc...
Andrew, You mean putchar must handle this issue (can't print the character). In this case it will return to its caller, printf, and the caller continues to send the remaining characters out. Correct ? In this case putchar must have a handler for the exceptions like timeouts, error flags. Correct again ? Regards Viktor
Take a look to the TRAFFIC example. The module SERIAL.C implements a putchar routine used by printf. The RTX51-Tiny performs a task switch in the middle of the printf statement. As it can be seen easily, there is no need to modify anything in the printf source code. printf is really complex and is bug free since years. I highly recommend not to touch such parts of the run-time library. Reinhard