diff --git a/.gitignore b/.gitignore index 9ef7e91..981fbc9 100644 --- a/.gitignore +++ b/.gitignore @@ -57,6 +57,7 @@ dkms.conf # Binary main +dvorakmsdos # debug information files *.dwo diff --git a/CMakeLists.txt b/CMakeLists.txt index 3d68935..00650a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,4 +4,6 @@ project(my_own_study_c_repo C) set(CMAKE_C_STANDARD 11) add_executable(my_own_study_c_repo - main.c) + main.c + dvorakmsdos.c + dvorakmsdos.h) diff --git a/dvorakmsdos.c b/dvorakmsdos.c new file mode 100644 index 0000000..e9cffc2 --- /dev/null +++ b/dvorakmsdos.c @@ -0,0 +1,6 @@ +#include "dvorakmsdos.h" +#include + +void msmain() { + printf("Hello World!\n"); +} \ No newline at end of file diff --git a/dvorakmsdos.h b/dvorakmsdos.h new file mode 100644 index 0000000..8b49fb6 --- /dev/null +++ b/dvorakmsdos.h @@ -0,0 +1,4 @@ +#ifndef MY_OWN_STUDY_C_REPO_DVORAKMSDOS_H +#define MY_OWN_STUDY_C_REPO_DVORAKMSDOS_H +void msmain(); +#endif //MY_OWN_STUDY_C_REPO_DVORAKMSDOS_H diff --git a/main.c b/main.c index 383cc34..dd5bb93 100644 --- a/main.c +++ b/main.c @@ -3,6 +3,7 @@ //importing basic modules #include #include +#include "dvorakmsdos.h" #ifdef _WIN32 #include #define GETCH() _getch() @@ -143,6 +144,7 @@ int main() { // PRESS ANY KEY TO CONTINUE printf("\n\nPress any key to continue..."); + fflush(stdout); // this forces the buffer to print NOW, fixing the "bug" in which it prints out everything AFTER the next line (scanf) GETCH(); #ifdef _WIN32 system("cls"); @@ -154,7 +156,7 @@ int main() { printf("\n\nINPUT BELOW:\n"); // DIVIDER char fruit[50]; //MAX 50 CHARACTERS printf("Pick a fruit (SINGLE WORD, EVERYTHING ELSE GETS IGNORED): "); - fflush(stdout); // this forces the buffer to print NOW, fixing the "bug" in which it prints out everything AFTER the next line (scanf) + fflush(stdout); // same use case as above in the first input part of the code scanf("%s", fruit); printf("\nYou choose %s as your fruit!", fruit); @@ -165,7 +167,7 @@ int main() { fflush(stdout); // same use case as above in the first input part of the code while (getchar() != '\n') {} // clears the input buffer so it doesnt print out excess input from the fruit one scanf(" %49[^\n]", vegetable); // the "[^\n]" means to read everything except a newline, which means you can input spaces inside now, 49 makes it so it doesnt crash once it has more than 50 characters - printf("The %s will be a perfect choice for this salat!", vegetable); + printf("\nThe %s will be a perfect choice for this salat!", vegetable); // END OF THE MAIN.C CODE, HERE YOU WILL BE ABLE TO CONTINUE ON TO OTHER EXPERIMENTS OF MINE printf("\n\nSWITCH OVER TO\n"); // DIVIDER @@ -175,7 +177,8 @@ int main() { fflush(stdout); // same use case as above in the first input part of the code char chc = GETCH(); if (chc == '1') { - printf("placeholder"); + msmain(); // calls dvorakmsdos.c + return 0; } else if (chc == '2') { return 0; } else {