Computing.Net > Forums > Web Development > C n HTML

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

C n HTML

Reply to Message Icon

Name: DOS programmeR
Date: October 2, 2009 at 19:57:24 Pacific
OS: Windows 98
CPU/Ram: ?
Product: Compaq / ?
Subcategory: HTML
Comment:

I have a problem. If I use the

 tag, it doesn't work:
<pre><code class="c">
printf("<h1>HI</h1>");
</code>

it displays on the page:

printf("<h1>HI</h1>");

How can I fix this?



Sponsored Link
Ads by Google

Response Number 1
Name: shutat
Date: October 3, 2009 at 01:58:52 Pacific
Reply:

If you're trying to use "C functions", then <code> is just an html tag that is used to set off any "code" in a fixed font for formatting purposes... it doesn't parse / compile C code.

Or do you mean something else?


0

Response Number 2
Name: DOS programmeR
Date: October 3, 2009 at 11:59:36 Pacific
Reply:

I'm trying to use C functions. How do I do this? Thanx


0

Response Number 3
Name: shutat
Date: October 3, 2009 at 23:52:45 Pacific
Reply:

You'd need to compile as a binary and upload into the cgi-bin folder... your host would also have to allow execution.

#include <stdio.h>

int main(void) {

   printf("Content-type: text/html\n\n"); // always needed
   printf("<html>\n");
   printf("<head>\n");
   printf("head elements\n");
   printf("</head>\n");
   printf("<body>\n");
   printf("body elements\n");
   printf("</body>\n");
   printf("</html>\n");

   return (0);
}

If your host allows for php, then it has similar functions to C including printf.

HTH


0

Response Number 4
Name: DOS programmeR
Date: October 4, 2009 at 11:01:21 Pacific
Reply:

How would I compile as binary?


0

Response Number 5
Name: shutat
Date: October 4, 2009 at 19:44:15 Pacific
Reply:

You'd need a C / C++ compiler and create an executable; here's gcc from gnu or you can mill over others here.

Here's a resource with source code and a few tips that may also help. However, if you're just using a few functions, then you really may want to consider a server side scripting language instead...

Good luck.


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon





Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: C n HTML

HTML forms without a full server? www.computing.net/answers/webdevel/html-forms-without-a-full-server/2394.html

view source problem www.computing.net/answers/webdevel/view-source-problem/760.html

quicktime videos in pop up windows www.computing.net/answers/webdevel/quicktime-videos-in-pop-up-windows/713.html