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

5
  • Aren't tags closed with forward-slashed instead of backslashes? Commented Oct 31, 2017 at 19:05
  • Possible duplicate of https://stackoverflow.com/questions/8765938/colorful-text-using-printf-in-c Commented Oct 31, 2017 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. Commented Oct 31, 2017 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. Commented Oct 31, 2017 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". Commented Nov 1, 2017 at 17:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.