From 7bce63179943d1870fce406c2257b91a03053240 Mon Sep 17 00:00:00 2001 From: Sambo Chea Date: Fri, 31 Jul 2020 21:44:03 +0700 Subject: [PATCH] Add read file functions and read welcome.txt data --- tests/work1.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/tests/work1.c b/tests/work1.c index 23517d8..29b9140 100644 --- a/tests/work1.c +++ b/tests/work1.c @@ -54,8 +54,29 @@ int main() void read_file() { // read the file here... + FILE *file; + char c; + + if ((file = fopen("./../data/welcome.txt", "r")) == NULL) { + printf("no file were found...!"); + } else { + while ((c = getc(file)) != EOF) + { + printf("%c", c); + } + } } -void menu() { +void menu(int menu) { // do something here... + switch (menu) + { + case 1: + printf("1. Student details..."); + break; + + default: + printf("No menu found here...!"); + break; + } }