How do I make C compiler to read the source code of an external html file from the C compiler?
Please reply.
How do I make C compiler to read the source code of an external html file from the C compiler?
Please reply.
Uh . . . that's way out of your league. Writing a C compiler, that is.
Explain what you're trying to do in more detail.
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
I have to write a program that will read the source code of any html and do some processes on its tags like <html>,<head>... etc.
You wouldn't be able to do this too effectively without a file stream: do you know how to use those? If you do:
1. Open a file stream to some HTML document
2. Read it line by line using fgets
3. Parse that line
4. ????
5. PROFIT!!
As determined here, you'll want to use a stack.
You'll need fopen(), fgets() or getc(), and fclose(). You can probably use an array for a stack and an int to store the location in the array. Something like this (this doesn't have error checking like stack under/overflow):
Code:int array[SIZE], pos = 0; void push(int x) { array[pos++] = x; } int pop(void) { return array[--pos]; }
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
I was planning of using stacks as the logic to get the dolution, but the tags to a html file will only b there in its source file. Hence if i use fopen on a html file, will i be able to reach its cource code?
Get an XML parcer librairy. XML is so simmilar to HTML that it should work just fine.
And yes, HTML is just source code. Your Browser is what interperts the HTML into a hypertext web page.
It is too clear and so it is hard to see.
A dunce once searched for fire with a lighted lantern.
Had he known what fire was,
He could have cooked his rice much sooner.
Don't forget that some HTML tags don't need a corresponding closing tag.
If you understand what you're doing, you're not learning anything.
That was mentioned in another thread about this program: http://board.theprogrammingsite.com/viewtopic.php?t=161
Yes . . . that's what fopen does. It opens a file stream that you can read from. The data in the stream comes from a file.I was planning of using stacks as the logic to get the dolution, but the tags to a html file will only b there in its source file. Hence if i use fopen on a html file, will i be able to reach its cource code?
You might want to read this tutorial, and maybe some others in the same section: http://www.cprogramming.com/tutorial/cfileio.html
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.