Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
02-16-2013, 02:44 PM #1
- Join Date
- Feb 2013
- Thanked 0 Times in 0 Posts
Reading C-Code contents from a file & displaying it in HTML page by syntax highlight
I am new to HTML coding.
I am creating a offline - local website to organize my c-codes.
I am trying to do the following things:
1. Read contents of a file (c-code in my case, where the file extension is *.c or *.txt).
2. Before displaying the read contents of the c-code, do the syntax highlighting.
You just need to call it in your <pre> </pre> tags like below and you get your c-code syntax highlighted:
<!-- -------------------- Code Start -------------------->
<!-- -------------------- Code End -------------------->
But, there are 2 disadvantages of doing this.
Firstly, you need to manually copy the c-code in the "Code Start" and "Code End".
The other problem in doing above is that, lot of codes are there, and there might be modifications in the *.c or *.txt files present on the local disk. So you need to manually do the changing of the code in your html file as well.
Can anybody give any other way which I can try.
I have tried several things, but I am not able to achieve this.
Your help will really be appreciated.
02-16-2013, 08:26 PM #2
- Join Date
- Jan 2006
- Halle (Saale), Germany
- Thanked 1,191 Times in 1,162 Posts