Introduction - If you have any usage issues, please Google them yourself
A while loop is used and will terminate when user will press esc key. To get the characters a function getche() is used conio.h which will store in char variable and store into the file using putc() function.
On pressing esc to avoid any other character written into the file an if condition is used which will write space into the file when user will press escape.