summaryrefslogtreecommitdiff
path: root/FormatHTML.cpp
diff options
context:
space:
mode:
authorDave Hibberd <d@vehibberd.com>2023-12-08 12:26:59 +0000
committerDave Hibberd <d@vehibberd.com>2023-12-08 12:26:59 +0000
commitfd1249b1e27896943e6f0558557ea55b9e87bd7e (patch)
tree756a6f7c89b22d9d92a175b430b4b323d94d3659 /FormatHTML.cpp
parentfda3d6ffaced810d4c98cf05dc2e29e934ed6eea (diff)
parent2ccd083256a3a05ae1f402a0ef259fbfff709088 (diff)
Update upstream source from tag 'upstream/6.0.24.22'
Update to upstream version '6.0.24.22' with Debian dir 0520fb299a06420760e7faf0173e3164bfbff640
Diffstat (limited to 'FormatHTML.cpp')
-rw-r--r--FormatHTML.cpp60
1 files changed, 60 insertions, 0 deletions
diff --git a/FormatHTML.cpp b/FormatHTML.cpp
new file mode 100644
index 0000000..f27498c
--- /dev/null
+++ b/FormatHTML.cpp
@@ -0,0 +1,60 @@
+// FormatHTML.cpp : Defines the entry point for the console application.
+//
+#include <stdio.h>
+
+int main () {
+ FILE *fp, *fp2;
+ char str[256];
+ char newstr[256];
+ char * ptr, * inptr;
+
+ /* opening file for reading */
+ fp = fopen("D:/AtomProject/test.html" , "r");
+ fp2 = fopen("D:/AtomProject/test.html.c" , "w");
+
+ if(fp == NULL) {
+ perror("Error opening file");
+ return(-1);
+ }
+
+ while(fgets (str, 256, fp) != NULL)
+ {
+ // Replace any " with \" and add " on front and \r\n" on end
+
+ char c;
+ ptr = newstr;
+ inptr = str;
+
+ c = *(inptr++);
+
+ *(ptr++) = '"';
+
+ while (c && c != 10)
+ {
+ if (c == '"')
+ *(ptr++) = '\\';
+
+ *(ptr++) = c;
+
+ c = *(inptr++);
+ }
+
+
+ *(ptr++) = '\\';
+ *(ptr++) = 'r';
+ *(ptr++) = '\\';
+ *(ptr++) = 'n';
+ *(ptr++) = '"';
+ *(ptr++) = 10;
+ *(ptr++) = 0;
+
+ puts(newstr);
+ fputs(newstr, fp2);
+
+ }
+
+ fclose(fp);
+ fclose(fp2);
+
+ return(0);
+} \ No newline at end of file