Actually, all of the xprintf functions use the core routines of sprintf to create the formatted output string before sedning that data to the target output (console for printf, files for fprintf, etc.) Douglas Wood Software Engineer -----Original Message----- From: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of Bob Ammerman Sent: Wednesday, October 25, 2000 5:07 PM To: PICLIST@MITVMA.MIT.EDU Subject: Re: [OT]: String constants in ANSI C (Was : String constants in ANSI C) ----- Original Message ----- From: Peter L. Peres To: Sent: Thursday, October 26, 2000 2:33 PM Subject: Re: [OT]: String constants in ANSI C (Was : String constants in ANSI C) > Concatenating strings and concatenating characters are two different > things. You have two characters #defined. To concatenate them you must > first make them strings. Of course there are shortcuts. Since strings are > arrays of char in C, you can so this: > > char buffer[8]; > > buffer[0]=CHAR1; > buffer[1]=CHAR2; > buffer[2]='\0'; /* this assignment is part of that proverbial rope */ > > disp(buffer); > > Or: > > sprintf(buffer,"%c%c",CHAR1,CHAR2); > disp(buffer); > > which does exactly the same thing but is more flexible. If you already use > a printf statement in your code then you can use the second form. If you > have no other printf then the first form will (may) save program space. Unfortunately, sprintf uses most of the same code as printf, so it won't reduce program size to use sprintf. Bob Ammerman RAm Systems (contract development of high performance, high function, low-level software) > > hope this helps, > > Peter > > -- > http://www.piclist.com hint: The list server can filter out subtopics > (like ads or off topics) for you. See http://www.piclist.com/#topics > > > > -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.