-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram_0.1.c
More file actions
33 lines (31 loc) · 1.23 KB
/
Program_0.1.c
File metadata and controls
33 lines (31 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include <ncurses.h>
/*
This library serves as an alternative to conio.h, which is specific to DOS-based
operating systems like Windows. Since conio.h is not a standard C library, in
Linux (which is what I am using), macOS, and probably in BSD as well, we need
to include this library or its predecessor, curses.h, to use functions that
provide equivalent functionalities to those of conio.h functions like getch();
and system("pause").
Note that you have to manually link the library while compiling the program like this:
gcc Program_0.1.c -o Program_0.1 -lncurses
*/
int main() {
// Not_A_simple program that prints "Hello, World"
initscr();//Initializes the ncurses mode, preparing the terminal for output
clear();//Equivalent of clrscr();
printw("Hello, World");//printf conflics with the other functions of ncurses
refresh();// Update the screen to show the printed message
getch();//waits for user input
endwin();//Ends ncurses mode, restoring the terminal to its original state
return 0;
/*If you are on windows(Unfortunately) then this program will work just as fine as the aboce program:
#include <stdio.h>
#include <conio.h>
int main() {
clrscr();
printf("Hello, World\n");
getch();
return 0;
}
*/
}