1

I am trying to change the font and color of the text in a printf statement. I cant get the below statement to work. Is there a library needed to use html with printf?

printf("<span font_desc='Sans 24' color='white'>Hello</span>"
       "<span font_desc='Sans 24' color='green'>World</span>\n");

I even tried something simple to bold the font and cant get it to work.

printf("<b>Hello</b>");

Any help with this would be greatly appreciated

Ivory244
  • 975
  • 1
  • 8
  • 12
  • Aren't tags closed with forward-slashed instead of backslashes? – tim4242 Oct 31 '17 at 19:05
  • Possible duplicate of `https://stackoverflow.com/questions/8765938/colorful-text-using-printf-in-c` – Jay Buckman Oct 31 '17 at 19:06
  • Fixed the typos in my question. Thank you for the link but they focus on the changing the color of the text. I also need to change the font type. – Ivory244 Oct 31 '17 at 19:45
  • 1
    Did you view source to make sure the results make sense, and match a working page created with a text editor? Or to back up, are you writing a .HTML page to be viewed in a browser? This is unlikely to work in other contexts. – Dave S Oct 31 '17 at 20:34
  • 1
    In which context does your program run? Is it supposed to create HTML pages, for example by running it as CGI-BIN? Or is it supposed to run in a shell? If the latter is the case, you have to use the shell-specific commands, not the HTML-"commands". – Xaver Nov 01 '17 at 17:25

0 Answers0