Today marks this blog’s 11th anniversary. The first post was made 11 years ago on April 13th, 2013. This date coincided with the release of my book, Beginning Programming with C For Dummies.
Continue reading
Using the epoll() Function to Scan for Standard Input
As with the select() function covered in last week’s Lesson, you can use other networking functions to scan for pending standard input while a program otherwise spins busy. The epoll() family of functions allow for such monitoring.
Continue reading
Calculating the Absolute Value – Solution
This month’s Exercise may not have been challenging. Still, remember that blog is about learning the C language. Sometimes performing what could be a simple task may end up being complex than you anticipated.
Continue reading
Reading the Keyboard Queue ala Networking
A network program monitors one or more file descriptors (such as sockets) for activity. It reacts when information is ready to process. This technique can also be applied to keyboard input, though not as elegantly as the kbhit() function shown in last week’s Lesson.
Continue reading
Calculating the Absolute Value
Difficulty: ★ ☆ ☆ ☆
I started my technology writing career at a computer book publishing house, CompuSoft. It’s no longer around, but I do recall ghost writing books such as the BASIC Handbook, which was an encyclopedia of the BASIC programming language. The first command listed in this book was ABS
.
Continue reading
Looking for a Keyboard Hit
The C language is famously platform independent. This feature may seem unimportant these days, but back in the early computer era having a language you code code on multiple systems was key to the C language’s success. This benefit may be one reason why C lacks a specific function to check on the keyboard status to determine whether a key has been pressed. Such a function is hardware-dependent.
Continue reading
What’s Next, Keyboard?
Suppose you must write code that remains busy while checking to see whether a key has been pressed. The program repeats a loop, performing various tasks, but eager for that key press. When a key is pressed, the code fetches the key. Two things stand in your way to make this happen.
Continue reading
Squaring a Value
The C language lacks an operator that squares a value or, more generally, raises a value to a specific power. To do so, use the pow() function. Yet I’m finding the need for a square() function as I explore some interesting and obscure mathematical thingies.
Continue reading
The alloca() Function
Any memory allocated in a function is retained when the function leaves, unless you first free it. This rule applies to all memory allocation functions — except one.
Continue reading
Calculating the Subfactorial – Solution
Do you feel adequately deranged working this month’s Exercise? I’m more of a math fanboy than an expert, yet I enjoyed the process of coding a subfactorial based in the equation presented.
Continue reading