The challenge for this month’s Exercise is to output yesterday’s date: the day of the week, day of the month, month, and year. It’s not as complex as it could be, though keep in mind that any code that outputs the proper result is valid.
Continue reading
Author Archives: dgookin
Checking the Time
I tend to keep the lessons on this blog specific to the standard C library, C99 release. Yet every so often a newer function draws my attention, which may not be standard but can still be useful. Case in point is the clock_gettime() function, which subscriber M.Stumpfl mentioned in a previous post.
Continue reading
Yesterday
Difficulty: ★ ★ ☆ ☆
The time.h header defines a handful of functions useful for discovering and manipulating today’s date. Especially the localtime() function, which translates a time_t (Unix Epoch) value into date fields for output or manipulation. It’s a wonderful tool, but what does it tell you about yesterday?
Continue reading
What the Heck is That Thing?
I just moved to a new computer. The process involved taking all my personal programs and re-compiling them for the new system. It took a while, but fortunately everything works with my various programs doing their necessary jobs. That is, unless I see a weirdo error upon compiling one of those golden oldies. On such error I saw made me wonder what they heck I was doing in my code.
Continue reading
The Final Output to HTML Code
The final update to the sconvert function includes translating characters &, <, and > for proper HTML output. With this update to the code from last week’s Lesson, the conversion filter is complete and can be used to translate C program text output into HTML code that I can easily post on the web.
Continue reading
Properly Padding Spaces and Tab Widths
The task for last week’s Lesson was to convert tabs as well as spaces. The problem is that tab stops aren’t considered: On the terminal, a tab character generates a variable number of spaces based on where the next tab stop position is located. It isn’t a fixed value.
Continue reading
C Blog 10th Anniversary
It was ten years ago today that I made the first post on this blog.

Continue reading
Properly Padding Spaces – and Tabs
As you can tell by the post title, part of the sconvert program I missed is to convert tab characters into HTML spaces. Like spaces, tabs output blanks that must be converted to the code for proper output on a web page.
Continue reading
Counting the Non-ASCII Bytes – Solution
Several items are noteworthy for this month’s Exercise , with the biggie being how to detect a non-ASCII character. The secret involves a wee bit of type conversion.
Continue reading
Counting the Non-ASCII Bytes
Difficulty: ★ ★ ☆ ☆
The file utility in Linux quickly identifies known file types. It identifies text files, graphics images, or other common file types by using some sort of magic beyond checking the filename extension (which isn’t a guarantee). You can employ similar sorcery by writing your own Is It ASCII program.
Continue reading