So, I have this air freshener night light in my bedroom. It has a wonderful glow and I think it brings out the best in me.
It’s probably that I am in bed, laptop keys glowing, warm screen ambiance set, all my problems seem to be solved for the day. Or I am just super comfortable at home. Whatever it is:
When I am here, I seem to write software 50 times better than when I am in the office.
It’s my happy place
Every once in a while I will get this urge to want to learn some C, C++. I am versed in Python and know my way around bash / Shell scripting like the back of my hand. But as always I am continuing to learn and self teaching myself is how learn the “BEST IS IS”.
Anyway let’s get to it, I wanted a program that would prompt a user for a sentence and then take that sentence and write it to a file, the program would have to create the file if it did not exist. Let me show you the code and attempt to break it down.
$ cat file_open.c
// Here we do our std library includes to allow the std::library functionality
// Here is where we declare our main function
printf("Enter a string you wish to write to a file:\n");