summaryrefslogtreecommitdiff
path: root/FormatHTML.cpp
diff options
context:
space:
mode:
authorDave Hibberd <d@vehibberd.com>2024-01-16 20:57:51 +0000
committerDave Hibberd <d@vehibberd.com>2024-01-16 20:57:51 +0000
commit645db7ce3d635490cb205a023181b002a24577ba (patch)
treedd76deb237a5f6c4004d2ebd7f187408d7d79124 /FormatHTML.cpp
parent1ff37aad018eb660726906caf54557d7b62a936a (diff)
parent710cc6fde7454126b4b749cc121c4bd0860aeb7f (diff)
Merge branch 'debian/latest' into debian/bookworm
Diffstat (limited to 'FormatHTML.cpp')
-rw-r--r--FormatHTML.cpp118
1 files changed, 59 insertions, 59 deletions
diff --git a/FormatHTML.cpp b/FormatHTML.cpp
index f27498c..88e306e 100644
--- a/FormatHTML.cpp
+++ b/FormatHTML.cpp
@@ -1,60 +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);
+// 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