Printing special characters

Started by Doug Jones, July 12, 2007, 12:10:47 AM

Previous topic - Next topic

Doug Jones

I'm using sanserif.
can someone tell me how to cause sprintf to print the degrees symbol?
I would like to place it after the third %d in the following code.

sprintf (pictureInfo, "X %d Y %d  angle %d\n %d X %d pixels\n %s\n %3.3f X %3.3f inches\n",
                        picture[selection].posX,
                        picture[selection].posY,
                        picture[selection].angle,
                        picture[selection].dimsCx,
                        picture[selection].dimsCy,
                        path,
                        picture[selection].pSizeCx,
                        picture[selection].pSizeCy
                       );

Thanks for the help, DJ


Doug Jones

Never mind.
I found the hex value for it.
The code looks like this now -

sprintf (pictureInfo, "X %d Y %d   %d%c\n %d X %d pixels\n %s\n %3.3f X %3.3f inches\n",
                        picture[selection].posX,
                        picture[selection].posY,
                        picture[selection].angle, 0xb0,
                        picture[selection].dimsCx,
                        picture[selection].dimsCy,
                        path,
                        picture[selection].pSizeCx,
                        picture[selection].pSizeCy
                       );


AlexN

Quote from: Doug Jones on July 12, 2007, 01:42:00 AM
sprintf (pictureInfo, "X %d Y %d   %d%c\n %d X %d pixels\n %s\n %3.3f X %3.3f inches\n",
                        picture[selection].posX,
                        picture[selection].posY,
                        picture[selection].angle, 0xb0,
                        picture[selection].dimsCx,
                        picture[selection].dimsCy,
                        path,
                        picture[selection].pSizeCx,
                        picture[selection].pSizeCy
                       );



or you write...

sprintf (pictureInfo, "X %d Y %d   %d\xb0\n %d X %d pixels\n %s\n %3.3f X %3.3f inches\n",
                        picture[selection].posX,
                        picture[selection].posY,
                        picture[selection].angle,
                        picture[selection].dimsCx,
                        picture[selection].dimsCy,
                        path,
                        picture[selection].pSizeCx,
                        picture[selection].pSizeCy
                       );


For a console application vou need \xf8 instead of \xb0;)
best regards
Alex ;)