diff --git a/firstConttrollWorkNumber3/firstConttrollWorkNumber3.sln b/firstConttrollWorkNumber3/firstConttrollWorkNumber3.sln
new file mode 100644
index 0000000..d9b0071
--- /dev/null
+++ b/firstConttrollWorkNumber3/firstConttrollWorkNumber3.sln
@@ -0,0 +1,31 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.0.31903.59
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "firstConttrollWorkNumber3", "firstConttrollWorkNumber3\firstConttrollWorkNumber3.vcxproj", "{73396A17-588A-46B5-B4B0-7D3BA4A3B49F}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {73396A17-588A-46B5-B4B0-7D3BA4A3B49F}.Debug|x64.ActiveCfg = Debug|x64
+ {73396A17-588A-46B5-B4B0-7D3BA4A3B49F}.Debug|x64.Build.0 = Debug|x64
+ {73396A17-588A-46B5-B4B0-7D3BA4A3B49F}.Debug|x86.ActiveCfg = Debug|Win32
+ {73396A17-588A-46B5-B4B0-7D3BA4A3B49F}.Debug|x86.Build.0 = Debug|Win32
+ {73396A17-588A-46B5-B4B0-7D3BA4A3B49F}.Release|x64.ActiveCfg = Release|x64
+ {73396A17-588A-46B5-B4B0-7D3BA4A3B49F}.Release|x64.Build.0 = Release|x64
+ {73396A17-588A-46B5-B4B0-7D3BA4A3B49F}.Release|x86.ActiveCfg = Release|Win32
+ {73396A17-588A-46B5-B4B0-7D3BA4A3B49F}.Release|x86.Build.0 = Release|Win32
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {93BDBD99-188F-4B02-B447-D7C8001633A5}
+ EndGlobalSection
+EndGlobal
diff --git a/firstConttrollWorkNumber3/firstConttrollWorkNumber3/firstConttrollWorkNumber3.vcxproj b/firstConttrollWorkNumber3/firstConttrollWorkNumber3/firstConttrollWorkNumber3.vcxproj
new file mode 100644
index 0000000..1085ac6
--- /dev/null
+++ b/firstConttrollWorkNumber3/firstConttrollWorkNumber3/firstConttrollWorkNumber3.vcxproj
@@ -0,0 +1,158 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+ Debug
+ x64
+
+
+ Release
+ x64
+
+
+
+ 16.0
+ Win32Proj
+ {73396a17-588a-46b5-b4b0-7d3ba4a3b49f}
+ firstConttrollWorkNumber3
+ 10.0
+
+
+
+ Application
+ true
+ v143
+ Unicode
+
+
+ Application
+ false
+ v143
+ true
+ Unicode
+
+
+ Application
+ true
+ v143
+ Unicode
+
+
+ Application
+ false
+ v143
+ true
+ Unicode
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+ false
+
+
+ true
+
+
+ false
+
+
+
+ Level3
+ true
+ WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+
+
+
+
+ Level3
+ true
+ true
+ true
+ WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
+ true
+
+
+ Console
+ true
+ true
+ true
+
+
+
+
+ Level3
+ false
+ _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/firstConttrollWorkNumber3/firstConttrollWorkNumber3/firstConttrollWorkNumber3.vcxproj.filters b/firstConttrollWorkNumber3/firstConttrollWorkNumber3/firstConttrollWorkNumber3.vcxproj.filters
new file mode 100644
index 0000000..f5ee0ee
--- /dev/null
+++ b/firstConttrollWorkNumber3/firstConttrollWorkNumber3/firstConttrollWorkNumber3.vcxproj.filters
@@ -0,0 +1,47 @@
+
+
+
+
+ {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/firstConttrollWorkNumber3/firstConttrollWorkNumber3/main.c b/firstConttrollWorkNumber3/firstConttrollWorkNumber3/main.c
new file mode 100644
index 0000000..d294179
--- /dev/null
+++ b/firstConttrollWorkNumber3/firstConttrollWorkNumber3/main.c
@@ -0,0 +1,39 @@
+#include "stack.h"
+#include "test.h"
+#include "workWithFile.h"
+#include
+#include
+
+int main() {
+ if (test()) {
+ printf("Test correct\n");
+ }
+ else {
+ printf("Error\n");
+ return -1;
+ }
+ printf("Enter fileName with extension No more than 99 symbols\n");
+ char fileName[100] = { '\0' };
+ int checkScanf = scanf_s("%s", fileName, 99);
+ while (checkScanf != 1) {
+ while (getchar() != '\n') {
+ }
+ checkScanf = scanf_s("%s", fileName, 99);
+ }
+ Error errorCheck = ok;
+ workWithFile(&errorCheck, fileName, fileName);
+ switch (errorCheck)
+ {
+ case(ok):
+ break;
+ case(emptyPointer):
+ printf("Error with null pointer\n");
+ return -1;
+ case(memoryError):
+ printf("Error with memory\n");
+ return -1;
+ case(anotherError):
+ printf("Error\n");
+ return -1;
+ }
+}
\ No newline at end of file
diff --git a/firstConttrollWorkNumber3/firstConttrollWorkNumber3/stack.c b/firstConttrollWorkNumber3/firstConttrollWorkNumber3/stack.c
new file mode 100644
index 0000000..cc4764b
--- /dev/null
+++ b/firstConttrollWorkNumber3/firstConttrollWorkNumber3/stack.c
@@ -0,0 +1,63 @@
+#include "stack.h"
+#include
+#include
+
+typedef struct NodeStack {
+ struct NodeStack* next;
+ int value;
+} NodeStack;
+
+typedef struct Stack {
+ struct NodeStack* head;
+}Stack;
+
+Stack* createStack(Error* errorCheck) {
+ Stack* stack = calloc(1, sizeof(Stack));
+ if (stack == NULL) {
+ *errorCheck = memoryError;
+ return NULL;
+ }
+ return stack;
+}
+
+void addElementToStack(Stack* stack, Error* errorCheck, int value) {
+ NodeStack* temp = calloc(1, sizeof(NodeStack));
+ if (temp == NULL) {
+ *errorCheck = memoryError;
+ return;
+ }
+ temp->value = value;
+ temp->next = stack->head;
+
+ stack->head = temp;
+ return;
+}
+int deleteElementInStack(Stack* stack, Error* errorCheck) {
+ if (stack == NULL || stack->head == NULL) {
+ *errorCheck = anotherError;
+ return;
+ }
+ int value = stack->head->value;
+ NodeStack* temp = stack->head->next;
+ free(stack->head);
+ stack->head = temp;
+ return value;
+}
+
+Stack* clearStack(Stack* stack, Error* errorCheck) {
+ if (stack == NULL) {
+ return;
+ }
+ while (!isEmpty(stack)) {
+ deleteElementInStack(stack, errorCheck);
+ if (*errorCheck != ok) {
+ return stack;
+ }
+ }
+ free(stack);
+ return NULL;
+}
+
+bool isEmpty(Stack* stack) {
+ return stack == NULL ? true : stack->head == NULL;
+}
\ No newline at end of file
diff --git a/firstConttrollWorkNumber3/firstConttrollWorkNumber3/stack.h b/firstConttrollWorkNumber3/firstConttrollWorkNumber3/stack.h
new file mode 100644
index 0000000..78b1367
--- /dev/null
+++ b/firstConttrollWorkNumber3/firstConttrollWorkNumber3/stack.h
@@ -0,0 +1,21 @@
+#pragma once
+#include
+
+typedef struct Stack Stack;
+
+typedef enum Error {
+ memoryError,
+ emptyPointer,
+ anotherError,
+ ok,
+}Error;
+
+Stack* createStack(Error* errorCheck);
+
+void addElementToStack(Stack* stack, Error* errorCheck, int value);
+
+int deleteElementInStack(Stack* stack, Error* errorCheck);
+
+Stack* clearStack(Stack* stack, Error* errorCheck);
+
+bool isEmpty(Stack* stack);
\ No newline at end of file
diff --git a/firstConttrollWorkNumber3/firstConttrollWorkNumber3/test.c b/firstConttrollWorkNumber3/firstConttrollWorkNumber3/test.c
new file mode 100644
index 0000000..8374730
--- /dev/null
+++ b/firstConttrollWorkNumber3/firstConttrollWorkNumber3/test.c
@@ -0,0 +1,25 @@
+#include "test.h"
+
+bool test() {
+ Error check = ok;
+ workWithFile(&check, "test.txt");
+ if (check != ok) {
+ return false;
+ }
+ FILE* file = fopen("test.txt", "r");
+ if (file == NULL) {
+ return false;
+ }
+ int arrayChecker[] = { 43, 32, 23, 122 };
+ int i = 0;
+ int number = 0;
+ while (fscanf(file, "%d", &number) == 1) {
+ if (number != arrayChecker[i]) {
+ fclose(file);
+ return false;
+ }
+ ++i;
+ }
+ workWithFile(&check, "test.txt");
+ return true;
+}
\ No newline at end of file
diff --git a/firstConttrollWorkNumber3/firstConttrollWorkNumber3/test.h b/firstConttrollWorkNumber3/firstConttrollWorkNumber3/test.h
new file mode 100644
index 0000000..f7e97d8
--- /dev/null
+++ b/firstConttrollWorkNumber3/firstConttrollWorkNumber3/test.h
@@ -0,0 +1,6 @@
+#pragma once
+#include "workWithFile.h"
+#include
+#include
+
+bool test();
\ No newline at end of file
diff --git a/firstConttrollWorkNumber3/firstConttrollWorkNumber3/test.txt b/firstConttrollWorkNumber3/firstConttrollWorkNumber3/test.txt
new file mode 100644
index 0000000..6eeba95
--- /dev/null
+++ b/firstConttrollWorkNumber3/firstConttrollWorkNumber3/test.txt
@@ -0,0 +1 @@
+122 23 32 43
\ No newline at end of file
diff --git a/firstConttrollWorkNumber3/firstConttrollWorkNumber3/workWithFile.c b/firstConttrollWorkNumber3/firstConttrollWorkNumber3/workWithFile.c
new file mode 100644
index 0000000..6a85bde
--- /dev/null
+++ b/firstConttrollWorkNumber3/firstConttrollWorkNumber3/workWithFile.c
@@ -0,0 +1,40 @@
+#include "workWithFile.h"
+
+void workWithFile(Error* errorCheck, const char* fileName) {
+ FILE* file = fopen(fileName, "r");
+ if (file == NULL) {
+ *errorCheck = anotherError;
+ return;
+ }
+
+ Stack* stack = createStack(errorCheck);
+ int number = 0;
+
+ while (fscanf(file, "%d", &number) == 1) {
+ addElementToStack(stack, errorCheck, number);
+ if (*errorCheck != ok) {
+ stack = clearStack(stack, errorCheck);
+ fclose(file);
+ return;
+ }
+ }
+ fclose(file);
+ file = fopen(fileName, "w");
+ if (file == NULL) {
+ *errorCheck = anotherError;
+ stack = clearStack(stack, errorCheck);
+ return;
+ }
+ fclose(file);
+ file = fopen(fileName, "a");
+ while (!isEmpty(stack)) {
+ number = deleteElementInStack(stack, errorCheck);
+ if (*errorCheck != ok) {
+ stack = clearStack(stack, errorCheck);
+ fclose(file);
+ return;
+ }
+ fprintf(file, "%d ", number);
+ }
+ fclose(file);
+}
\ No newline at end of file
diff --git a/firstConttrollWorkNumber3/firstConttrollWorkNumber3/workWithFile.h b/firstConttrollWorkNumber3/firstConttrollWorkNumber3/workWithFile.h
new file mode 100644
index 0000000..6287024
--- /dev/null
+++ b/firstConttrollWorkNumber3/firstConttrollWorkNumber3/workWithFile.h
@@ -0,0 +1,7 @@
+#pragma once
+#include "stack.h"
+#include "test.h"
+#include
+#include
+
+void workWithFile(Error* errorCheck, const char* fileName);
\ No newline at end of file