From your early C language training, you should know the difference between 1088 as a string and 1088 as an integer. They may look the same to human eyes, but inside the computer they’re completely different.
Continue reading
Author Archives: dgookin
Counting in Alphabedecimal
In C, you can easily count from 000 to 999 (decimal), from 000 to 777 (octal), and from 000 to FFF (hexadecimal). These examples are in bases 10, 8, and 16, respectively. When it comes to counting from AAAA to ZZZZ, however, you must code your own routine.
Continue reading
Reading and Writing Values
Writing a value to a file and reading it from a file work exactly like reading and writing values from standard input and output. File-based versions of standard I/O functions are used, so the process should be familiar to you. Still, there’s an interesting catch.
Continue reading
Working with Text Files Longer than a Single Line
Unless your program also created the file it’s reading, you have no guarantee how must text lurks inside. It could be a single character or the entire works of Shakespeare. Dealing with an unknown quantity of text it a file-reading challenge.
Continue reading
File Writing and Reading
Sending text to standard output is something you learn with your first C program. The common functions are putchar(), puts(), printf(), and so on. When you explore file access, you’ll find familiarity in those functions because they’re quite similar to the standard I/O functions.
Continue reading
Initial Caps – Solution
The solution for this month’s Exercise is perhaps a bit trickier than you may have anticipated. The issue is to set the first letter of a word as upper case and the remaining letters lowercase. The solution I devised involves reading two characters at a time.
Continue reading
A File Outta Nowhere
I had such a struggle with file I/O when I first learned computer programming. I knew what a file was and how to create it in an application. With computer programming, however, you enter a lower-level realm that requires more knowledge of file access.
Continue reading
Initial Caps
A filter is a program that accepts standard input and generates standard output. These programs are fun to write, providing you have a goal in mind and some way to manipulate the incoming text in a manner that’s significant enough to notice in the output.
Continue reading
Fun with Preprocessor Names
Your probably familiar with the #include and #define preprocessor directives. You may know a few more, which come in handy for certain coding issues. I have a page on this blog, which goes over some of the common directives, but it doesn’t cover them all. Specifically, it doesn’t cover the preprocessor names.
Continue reading
Recursively Plowing a Directory Tree
The code to recursively plow a directory tree presented in last week’s Lesson could be improved upon. Primarily, it relies upon the .. shortcut to jump back to the parent directory. This method works only some of the time.
Continue reading