Thread: Appending HTML to C .. help!

  1. #1
    Registered User
    Join Date
    Feb 2005
    Posts
    11

    Angry Appending HTML to C .. help!

    Hey, I'm writing a small script to format C code with html to make it more presentable on my site-- making different aspects of the code a certain color. I'm having some trouble though.. finding every occurance of the strings is easy enough, but it's inserting the necessary html just before and after each occurance of the string that is getting to me. For example, at the beginning of a comment I may want to stick a:

    <font color="#999999">

    tag in there, and an ending </font> tag right after. The ending tag is fine, I can do that.. it's just inserting something before the comment (or whatever string I'm working with) that has me hung up .. I hope this makes sense .. any ideas?

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Try looking at the source of this program. It does the same thing you want to do and as such you might be able to benefit directly by seeing how they did it.

  3. #3
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,534
    Well, lets have a look at your code - no sense in trying to guess what you are attempting..

    As an aside, this is a pretty slick syntax highlighter conversion tool. It generates W3 CSS and XHTML compliant code - and it around 30 different predefined highlight templates to choose from, or you can make your own.

    ~/

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. [C] Displaying HTML in an application.
    By pc2-brazil in forum Windows Programming
    Replies: 2
    Last Post: 12-17-2008, 01:45 AM
  2. Please Help - C code creates dynamic HTML
    By Christie2008 in forum C Programming
    Replies: 19
    Last Post: 04-02-2008, 07:36 PM
  3. Writing an HTML Preprocessor
    By thetinman in forum C++ Programming
    Replies: 1
    Last Post: 09-17-2007, 08:01 AM
  4. Design + HTML
    By orbitz in forum C Programming
    Replies: 8
    Last Post: 11-21-2002, 06:32 AM