![]() |
|
#1
|
|||
|
|||
convert C to HTML!i was messing around and wondering if we can convert C into html. my idea is to replace all the greater-than or less-than character when we pull a certain program that already stored:
replace "<" with "<" and ">" with ">" when we pull up the program (beacause html don't use "<" or ">" in the code. ) for example CPP / C++ / C Code:
output of program Code:
i'm looking for surgestion. thank u here is wat i have so far CPP / C++ / C Code:
Last edited by LuciWiz : 12-Jun-2006 at 05:36.
Reason: Please insert your C code between [c] & [/c] tags
|
|
#2
|
|||
|
|||
Re: convert C to HTML!Quote:
I like it! It sounds like a fairly straightforward project to increase your knowledge of C and of html. Quote:
Suggestion number 1: Make a plan (ya gotta have a plan). See footnotes. You have the beginnings of a program specification: replace '<' and '>' with stuff that works with html. You have the beginnings of a program: Takes a C file and replaces '<' and '>' with stuff that you hope works with html. What you need is a test plan. I never, ever start coding (even pseudo coding) a project without some idea of how I am going to test it. Here is one approach --- the test plan is to look at your browser's rendering of the html stuff. SO: put the output of your program into a file. Call the file, say, z.htm or z.html or some such thing. Then, in your browser, open your html file. (In Microsoft IE select Open from the File menu. In Firefox click "Open file" from the File menu.) What happens? If it looks OK, then try bigger files with more "C" stuff (Maybe there are things that need to be changed other than '<' and '>' ? Or, maybe, not. Maybe you can find a good html reference and browse through it for additional information.) Now if it doesn't look like you thought it should, how can you fix it? Well, you could go through the html reference and try to see how to get your desired output. Here's what might be a quicker way: Pick a page on some web site (like your original post on this forum, for example) and view its source. On either browser, open the page (the normal html view, as I suggested above) and then right-click within the page's window. Click on "view source" and the file's html source will open with a text editor. Look at places where '<' and '>' were displayed OK in the html view. How does the gt and lt stuff actually work? How does it get a newline so that each source code line is on its own line in the html view? I suggest that you first make changes directly in your html file so that it looks OK in the browser html view, and then change your program to give that output. It may take a few iterations, but you can see the effects of program changes immediately in your browser html view window (You can even leave the file's html view open and click on the "refresh" icon to see the effects of changes in its source.) If there is something that you can't really figure out, there's always the html reference to "fall back on." Have fun. Regards, Dave Footnotes: "Ya gotta have a plan." davekw7x --- on gidforums.com ----------------- "The best-laid schemes o' mice an' men Gang aft agley" Robert Burns ---To A Mouse, On Turning Her Up In Her Nest With The Plough ----------------- "We can face our problem. We can arrange such facts as we have with order and method." Hercule Poirot --- in Murder on the Orient Express Last edited by davekw7x : 10-Jun-2006 at 11:25.
|
|
#3
|
|||
|
|||
Re: convert C to HTML!Aswell as replacing less than/more than characters you could replace quote marks ("
Like davekw7x said put together a plan, write your notes and ideas down in notepad, doesn't matter if they are not neat, but just make sure they are readable and understandable. Once you have a rough idea of where you want your project to go start to write it up in pseudo-code. |
Recent GIDBlog
Observations of Iraq by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| including html help last time! | dopee | MySQL / PHP Forum | 3 | 14-Feb-2005 04:08 |
| working with html HELP | dopee | MySQL / PHP Forum | 10 | 18-Jan-2005 04:31 |
| saving html text | dopee | MySQL / PHP Forum | 1 | 17-Jan-2005 04:15 |
| What should I use? XHTML 1.0 or HTML 4.01 Strict? | retxedz | Web Design Forum | 0 | 24-Dec-2004 15:56 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The