CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2001
    Posts
    17

    Write HTML format to file

    I need to write an html file and I am using PRINT statement. The problem is that there are to many " and \ where I thought to use chr(34) function. This is very time consuming. Is there an easer way to write " and / characters?


  2. #2
    Join Date
    Feb 2001
    Location
    Stamford CT USA
    Posts
    2,167

    Re: Write HTML format to file

    Not sure if you're concern with CPU time consuming or typing the actual code (having a lot of "" every where can be pretty confusing too).

    Anyway, you can assign a " to a var like this:
    szQuote = """"
    and then you can use it like this:
    print #1, "<body bgcolor=" & szQuote & "yellow" & szQuote & ">"

    But I don't see the advantage on doing so compared to:
    print #1, "<body bgcolor=""yellow"">"

    Maybe you can explain more on the problem.
    -Cool Bizs

    Good Luck,
    -Cool Bizs

  3. #3
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: Write HTML format to file

    Well in a lot of case yo ucan omit the " in html.
    <BODY BGCOLOR=BLUE> will give the same result as <BODY BGCOLOR="BLUE">

    OR

    you might want to cinsider to put the default stuff in a file and read that file. Like the part you use in the beginning of you document. This brings another advantage that you don't need to recompile your app if you want to change the style of the page.

    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured