Hello, does anyone know anywhere where I can get code for _doprnt that takes a custom character output function? I have a version in a book but there is 4 pages worth of code and I'd prefer to avoid writing all that...
For instance, if the character output function is 'kputc' which takes 1 argument (the character), I could call _doprnt like so:
_doprnt( format, args, kputc );
Does anyone know where to find code for this?
doprnt with custom function
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
Yeah, it's useful for something like _doprnt because it means that you don't have to write 8 different versions for your 8 different character handling routines (like putc,kputc,fputc etc...)
However, Turbo C already comes with a whole lot of console stuff that uses BIOS interrupts which means that I can concentrate on other parts of my OS (like memory management, tasks etc...).
However, Turbo C already comes with a whole lot of console stuff that uses BIOS interrupts which means that I can concentrate on other parts of my OS (like memory management, tasks etc...).
I am not sure I can follow you there. I can understand where _doprnt() might be a nice solution for using the same format parsing code for kernel space (kputc) and user space (fputc), but beyond those two? putc() is defined to be the same as fputc() in effect, only that it may be a macro...?pcmattman wrote:Yeah, it's useful for something like _doprnt because it means that you don't have to write 8 different versions for your 8 different character handling routines (like putc,kputc,fputc etc...)
Every good solution is obvious once you've found it.