Most C programmers know the sleep() function, which pauses program execution for a given number of seconds. Seconds are a vast chunk of time, especially in a computer where things happen quickly. So a desire exists for a function that delays execution for smaller slices of time. For that duty you’ll need to code your own function, similar to the delay() function I use.
Continue reading
Author Archives: dgookin
Error Message to stdout
The three standard I/O devices are stdin, stdout, and stderr. They represent the devices for standard input, standard output, and standard error messages. While you might see plenty of examples of stdin and stdout, examples of stderr are less common, although they don’t have to be.
Continue reading
Calculating a Unix Epoch Date
Before you can embark upon the frightening topic of Time Math, you need to convert dates and times into Unix Epoch time_t values. It’s not that difficult of a task, assuming that you can accept that time programming in C isn’t complex and rude, which of course it is.
Continue reading
Binary Bit Fun: |
May the 4th be with you! It’s Jedi day, or Star Wars day, or whatever. Here’s a binary puzzle for you, one which demonstrates how the bitwise OR operator can be used to set bits in an integer value.
Continue reading
Word Swapping
For your May challenge, write code that takes a two word sentence and displays the words in reverse order. For example, take the string Swap me and have the program spit out the text me Swap.
Continue reading
Hello, Environment
The operating system keeps several variables in memory, variables that hold information necessary to running the computer. For example, the path variable lists directories in which the operating system looks for programs. The prompt variable describes how to display the command prompt. Some programs even create variables, allowing the programs to save configuration or other information.
Continue reading
What’s the sizeof That?
When writing a structure to a file, you need to ensure that you specify the proper structure size. The sizeof keyword is obviously the way you determine the size, but what exactly are you getting the size of?
Continue reading
printf(“Hello world!\n”);
Welcome to the C For Dummies blog.
Continue reading