From 9ad7fc80842f561aa0a3f05d457366d0388af52f Mon Sep 17 00:00:00 2001 From: Suman Biswas <89653112+mrsumanbiswas@users.noreply.github.com> Date: Thu, 15 Dec 2022 20:51:51 +0530 Subject: [PATCH 1/6] Create .gitignore --- .gitignore | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c6127b3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,52 @@ +# Prerequisites +*.d + +# Object files +*.o +*.ko +*.obj +*.elf + +# Linker output +*.ilk +*.map +*.exp + +# Precompiled Headers +*.gch +*.pch + +# Libraries +*.lib +*.a +*.la +*.lo + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + +# Debug files +*.dSYM/ +*.su +*.idb +*.pdb + +# Kernel Module Compile Results +*.mod* +*.cmd +.tmp_versions/ +modules.order +Module.symvers +Mkfile.old +dkms.conf From 2eced54ea43e65729710f74861c8537e2caec1a1 Mon Sep 17 00:00:00 2001 From: Suman Biswas Date: Thu, 15 Dec 2022 21:08:57 +0530 Subject: [PATCH 2/6] chore: update .gitignore --- .gitignore | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.gitignore b/.gitignore index c6127b3..cb2d176 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,8 @@ modules.order Module.symvers Mkfile.old dkms.conf + +# vscode +.vscode +vscode +.vscode/* \ No newline at end of file From 0c7029a15804c15da07a7a3b8b4cbed9382960e4 Mon Sep 17 00:00:00 2001 From: Suman Biswas Date: Thu, 15 Dec 2022 21:09:32 +0530 Subject: [PATCH 3/6] docs: create assignments/02/README.Md --- assignments/02/README.Md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 assignments/02/README.Md diff --git a/assignments/02/README.Md b/assignments/02/README.Md new file mode 100644 index 0000000..11c1c4f --- /dev/null +++ b/assignments/02/README.Md @@ -0,0 +1,29 @@ +# Problem Statement # +## A _C_ Program that will create a txt file. ## + +**The program problem statement :** +1. This will ask how many lines do user want to write. +2. Then this will read lines accordingly. +3. Then it will ask whether to save or not. +4. At last, it will ask for the file name to save. + + +### Example +```text +$ ./a.out +How many line do you want to write ? +> 3 (eg. 3) +Alright start writting... + +1| I'm Suman. +2| And this is a C project. +3| But my favorite language is Rust. + +Do you want to save it ? (Y/N) +> Y (eg. Y & Y is by ) + +Please gave A file name. +> abcd (eg. abcd) + +// This will save a file named `abcd.txt` +``` From acbaee849dce2d26c6c1b703d5c2233fde4fc074 Mon Sep 17 00:00:00 2001 From: Suman Biswas Date: Thu, 15 Dec 2022 21:09:39 +0530 Subject: [PATCH 4/6] feat: create main.c --- assignments/02/main.c | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 assignments/02/main.c diff --git a/assignments/02/main.c b/assignments/02/main.c new file mode 100644 index 0000000..b785677 --- /dev/null +++ b/assignments/02/main.c @@ -0,0 +1,6 @@ +#include + +int main(){ + + return 0; +} \ No newline at end of file From 370025b522fe994d56119686137ed9422d464a8c Mon Sep 17 00:00:00 2001 From: Suman Biswas Date: Thu, 15 Dec 2022 23:18:40 +0530 Subject: [PATCH 5/6] update main.c --- assignments/02/main.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/assignments/02/main.c b/assignments/02/main.c index b785677..086856c 100644 --- a/assignments/02/main.c +++ b/assignments/02/main.c @@ -1,6 +1,37 @@ #include +#include -int main(){ +int main() +{ + int lines = 0; + char text[lines][1024], fileName[25]; + char YN; + + printf("How many lines do you want to write ?\n> "); + scanf("%d", &lines); + + if (lines) + { + char temp[256]; + for (int i = 0; i < lines; i++) + { + printf("%d | ", i + 1); + scanf("%s", temp); + strcpy(text[i], temp); + } + } + else + { + printf("No lines to write\n"); + } + + printf("Do you want to save it ?(Y/N)\n> "); + scanf("%s", &YN); + + if (YN == 'N' || YN == 'n') + { + printf("s"); + } return 0; } \ No newline at end of file From 3e7b3a0d3b9e2d60b6e43d6432c04cd305c4cd22 Mon Sep 17 00:00:00 2001 From: Suman Biswas <89653112+mrsumanbiswas@users.noreply.github.com> Date: Thu, 15 Dec 2022 23:22:53 +0530 Subject: [PATCH 6/6] Update main.c --- assignments/02/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/assignments/02/main.c b/assignments/02/main.c index 086856c..07acc33 100644 --- a/assignments/02/main.c +++ b/assignments/02/main.c @@ -34,4 +34,7 @@ int main() } return 0; -} \ No newline at end of file +} + +// unable to coplete need help! +// unable to get line from cli