On Thu, 21 Mar 2002, Barry Gershenfeld wrote: > >> > printf(my_lcd_putc, "Here is an integer: %d", d) > >> Uhh, Bob, what compiler was this code for if Imay ask ? > >I really don't know, but it had some strange way of passing a function as > >the first parameter of printf to define a sink for the characters generated. > >Wierd, huh? > > I have a memory for weirdness. That's CCS. The description is: > > "...fname is a function name to be used for outputting > (default is putc is none is specified)." > > Apparently (from an example in the back) it will call the > supplied function once for each character generated by > printf. I guess it's a cheap alternative for not > having sprintf. Well, kinda. There is now sprintf and fprintf, but sprintf outputs to a string, not a function. The fprintf function recently added only (I think) supports output to a defined serial output stream, so if you need to use it with another function you've got issues, as they say at work. I kind of suspect they're working toward implementing a file-like IO where you can use fprintf to direct output to another function, but they're not there yet. CCS seems to have a "release early and often" philosophy, which has its good and bad points. Mostly good, I've only been inconvenienced by twitchy compiler releases once, and the fix is usually pretty simple -- avoid the affected function, or go back a version. Dale -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body