Thread: Exporting HTML

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    5

    Exporting HTML

    I seem to be a fan of doing things the hard way:

    Code:
    ///////////////////////
    void ExportResults()
    ///////////////////////
    {
    if(CursorY == 5)
         {
         fstream file_op("Results.html",ios::out);
         file_op<<
         "<html><head><title>Results</title></head>"
         "<body vlink=""white" "alink=""white" "link=""white" "style=""color: rgb(255, 255, 255); background-color: rgb(0, 0, 0);"">"
         "<center><img src=""RedInk.JPG""></center><br>"
         "<span style=""color: rgb(255, 255, 255); font-family: arial;"">"
         "Format: <br>"
         "Author's Last Name: <br>"
         "Author's First & Middle Name: <br>"
         "Title: <br>"
         "City: <br>"
         "Publishing Company: <br>"
         "Year: <br>"
         "<br>"
         "<br>"
         "Formatted Works Cited Information: <br>"
         "</span>"
         "<br>"
         "<br>"
         "<br>"
         "<br>"
         "<br>"
         "<br>"
         "<br>"
         "<br>"
         "<br>"
         "<br>"
         "<hr>"
         "<span style=""color: rgb(255, 255, 255); font-family: arial;""><font size=""-1"">"
         "&copy Walker Burgin 2004<br>"
         "If you found this program helpful please visit my website at  <a href=""http://www.worldapart.ne1.net"">www.worldapart.ne1.net</a> and leave me a comment in my guetsbook. If you have any questions or suggestions <br>"
         "please send me an email at [email protected]."
         "</span></body></html><br>";
         file_op.close();
         system("Results.html");
         }
    }
    The idea is to export the results of my program into a webpage so it can be easily copied into a document.
    My problem is that as of now the program exports the html with no quotation marks. I've tried using \" but for some reason they're still
    not coming out, any ideas?

    Walker

  2. #2
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    It should work with the \". They just aren't there even if you do that?
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    At no point in your code do you have a single \". All you have are pairs of (incrorrectly placed at times, mind you) double quotes. That should get the strings working for you.

  4. #4
    Registered User
    Join Date
    Aug 2004
    Posts
    5
    I know I didn't have any /" in the posted code, I took them back out because they weren't working. Turns out the problem's in the html, not the programming. That's a bit odd though because I made the page with Mozilla composer and copied that into the compiler...I slimmed it down a bit but I didn't do anything that would add the extra "s. At least it's working. Thanks for the help!

    Walker

  5. #5
    Crazy Fool Perspective's Avatar
    Join Date
    Jan 2003
    Location
    Canada
    Posts
    2,640
    Quote Originally Posted by WalkerBurgin
    I know I didn't have any /"
    thats your problem, you want \" (notice the back slash)

  6. #6
    Registered User
    Join Date
    Aug 2004
    Posts
    5
    sorry that was just a typo, I got it working.

    Walker

  7. #7
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Also note that your html isn't valid per the w3 standard

  8. #8
    Registered User
    Join Date
    Jul 2004
    Posts
    60
    Quote Originally Posted by Thantos
    Also note that your html isn't valid per the w3 standard
    Correct Thantos. After all your tags that dont have a closing tag, you need to put a / before the closing >.
    Child who knows C++
    Using Borland C/C++ Compiler 5.5 (Command Line Version)

  9. #9
    the Wizard
    Join Date
    Aug 2004
    Posts
    109
    Well I don't think that his programing will crash if he can't put an "/" in fx. the end of his <img> tags No offence.... So why is it important mentioning it?? As mentioned no offence, just curious
    -//Marc Poulsen -//MipZhaP

    He sat down, he programmed, he got an error...

  10. #10
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    Why not mention a possible problem? Yeah it probably won't make any huge difference but I know from first hand experience how important it is to follow the w3 standard.

  11. #11
    the Wizard
    Join Date
    Aug 2004
    Posts
    109
    Yeah, your probably right, when your writing a homepage it is a VERY good idea
    I just thought as the first thing that he knew it. But let's leave it
    -//Marc Poulsen -//MipZhaP

    He sat down, he programmed, he got an error...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Please Help - C code creates dynamic HTML
    By Christie2008 in forum C Programming
    Replies: 19
    Last Post: 04-02-2008, 07:36 PM
  2. Writing an HTML Preprocessor
    By thetinman in forum C++ Programming
    Replies: 1
    Last Post: 09-17-2007, 08:01 AM
  3. Design + HTML
    By orbitz in forum C Programming
    Replies: 8
    Last Post: 11-21-2002, 06:32 AM
  4. Exporting Object Hierarchies from a DLL
    By andy668 in forum C++ Programming
    Replies: 0
    Last Post: 10-20-2001, 01:26 PM