NO

Author Topic: Printing special characters  (Read 6142 times)

Doug Jones

  • Guest
Printing special characters
« on: July 12, 2007, 12:10:47 AM »
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

  • Guest
Re: Printing special characters
« Reply #1 on: July 12, 2007, 01:42:00 AM »
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
                       );


Offline AlexN

  • Global Moderator
  • Member
  • *****
  • Posts: 394
    • Alex's Link Sammlung
Re: Printing special characters
« Reply #2 on: July 12, 2007, 07:37:04 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...
Code: [Select]
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 ;)