From a1c30adacf994b09275cc00d4cf967f786c343ee Mon Sep 17 00:00:00 2001 From: Kaehvaman Date: Fri, 22 Nov 2024 17:26:41 +0400 Subject: [PATCH] add lab24 --- lab24/files/alice.html | 8 +++ lab24/files/text1.txt | 7 ++ lab24/lab24.vcxproj | 135 ++++++++++++++++++++++++++++++++++++ lab24/lab24.vcxproj.filters | 22 ++++++ lab24/main.c | 45 ++++++++++++ 5 files changed, 217 insertions(+) create mode 100644 lab24/files/alice.html create mode 100644 lab24/files/text1.txt create mode 100644 lab24/lab24.vcxproj create mode 100644 lab24/lab24.vcxproj.filters create mode 100644 lab24/main.c diff --git a/lab24/files/alice.html b/lab24/files/alice.html new file mode 100644 index 0000000..648747c --- /dev/null +++ b/lab24/files/alice.html @@ -0,0 +1,8 @@ +HTML DocumentAlice's Adventures in Wonderland +
Lewis Carroll +
+
+
Chapter I +
DOWN THE RABBIT-HOLE +
+
Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, "and what is the use of a book", thought Alice "without pictures or conversation?" diff --git a/lab24/files/text1.txt b/lab24/files/text1.txt new file mode 100644 index 0000000..f06ac82 --- /dev/null +++ b/lab24/files/text1.txt @@ -0,0 +1,7 @@ +Lewis Carroll + + +Chapter I +DOWN THE RABBIT-HOLE + +Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, "and what is the use of a book", thought Alice "without pictures or conversation?" \ No newline at end of file diff --git a/lab24/lab24.vcxproj b/lab24/lab24.vcxproj new file mode 100644 index 0000000..70ba35b --- /dev/null +++ b/lab24/lab24.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {261b6e46-77ea-4d5c-96ef-81d1af276697} + lab24 + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + \ No newline at end of file diff --git a/lab24/lab24.vcxproj.filters b/lab24/lab24.vcxproj.filters new file mode 100644 index 0000000..48814f7 --- /dev/null +++ b/lab24/lab24.vcxproj.filters @@ -0,0 +1,22 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Исходные файлы + + + \ No newline at end of file diff --git a/lab24/main.c b/lab24/main.c new file mode 100644 index 0000000..92a82e2 --- /dev/null +++ b/lab24/main.c @@ -0,0 +1,45 @@ +#include +#include + +void task1() { + FILE* fin = fopen("files/text1.txt", "r"); + if (fin == NULL) { + puts("File cannot be opened"); + return 0; + } + FILE* fout = fopen("files/out1.html", "r"); + if (fin == NULL) { + puts("File cannot be opened"); + return 0; + } + + + fprintf(fout, ""); + fprintf(fout, ""); + fprintf(fout, ""); + fprintf(fout, ""); + fprintf(fout, "HTML Document"); + fprintf(fout, ""); + fprintf(fout, ""); + + char ch; + while ((ch = getc(fin)) != EOF) { + if (ch == '\n') { + fprintf(fout, "
"); + } + else { + putc(ch, fout); + } + } + + fprintf(fout, ""); + fprintf(fout, ""); +} + + +int main() { + + task1(); + + return 0; +}