All of the code I’ve written in my books as well as demonstrated on this blog has been single-tasking: The program runs as one process, does one thing, in order, and then terminates. With this Lesson, that streak ends.
Continue reading
Spelling Alphabet
The spelling alphabet is a tool used by the military, police, and other professionals. It helps them to sound cool when they spell names. You’ve probably attempted to spell that way yourself, even if you didn’t know any official spelling alphabet. Lots of people say, “N as in Nancy.” That’s how the spelling alphabet works.
Continue reading
Know Your Process
Program. Software. Application. Process. These are all terms that describe different aspects of a similar thing.
Continue reading
The Marvelous popen() Function
To launch and run another program from within your code, use the system() function. When your code must examine or save that program’s output, use the popen() function.
Continue reading
Execute and Leave
The system() function allows you to run one program from within another. If it’s your desire to launch another program and have your program quit, you can immediately follow system() with an exit() function. Or you can go out of your way and use the oddball execl() function.
Continue reading
Let’s Go Bowling – An Entire Game – Solution
To make the conversion between simulating a single frame of bowling and an entire game isn’t that simple, which is mostly due to calculating the dreaded 10th Frame.
Continue reading
The Joys of Iteration
Suppose that you’re testing code and need to run a program six times in a row. You could keep repeating the program, running it multiple times, but why not write a utility that does the same thing? That would be a good and practical way to put the system() function to work.
Continue reading
Let’s Go Bowling – An Entire Game!
In last month’s Exercise, the assignment was to craft a single frame in a game of bowling. This time, you need to stitch together 10 frames to simulate bowling an entire game.
Continue reading
Hello, System
One thing that continues to puzzle me about learning the C language is how frequently beginners use the system() function. Is it a crutch? Is it a necessity? What’s the allure of this function that makes it show up in beginner code?
Continue reading
Before You Say Goodbye . . .
The standard C library contains a lot of interesting and unusual routines. Some can really put the fun into function. One of them I’ve rarely used, but which can be extremely handy, is atexit().
Continue reading