Encoding means nothing if you can’t decode, which is the task for this month’s Exercise: Transform the encoded hex bytes back into characters, unwinding the formula used to create them. The challenge isn’t really as much with coding the math as it is with translating hex bytes back into integer values — characters.
Continue reading
Author Archives: dgookin
A Tally of Unique Words, Part V
The next step in the unique words program is to tally the count of each word. From last week’s Lesson, the word list is sorted, which makes the task of counting duplicates easy.
Continue reading
Decoding a String
Difficulty: Medium
The task for last month’s Exercise was to encode a string. As you may have feared, the task for this month’s Exercise is to decode that string. Let me review:
Continue reading
A Tally of Unique Words, Part IV
In our last episode, the unique words code is able to parse and list individual words in the buffer. To find unique and duplicate words, the next step is to sort the list.
Continue reading
A Tally of Unique Words, Part III
From last week’s Lesson, the text in a buffer is parsed, creating pointers to each word in the string. Alas, the addresses of these words (the pointers) aren’t saved, which is stupid. To handle the job, and to keep the Unique Words project moving forward, a dynamic array of pointers must be allocated.
Continue reading
A Tally of Unique Words, Part II
Continuing with my Unique Words project from last week’s Lesson: Once the buffer contains text, the next step is to parse the words: to split the long string of text stored in memory into separate word chunks. For this task, I turn to my old pall, the strtok() function.
Continue reading
A Tally of Unique Words, Part I
It’s easy for a good C programmer to code a program to tally the number of unique words in a chunk of text. Further, the computer could track repeating words. This task would drive a human nuts, but a computer? No problem.
Continue reading
Encoding a String – Solution
The task for this month’s Exercise is to write an encoding filter that follows a specific pattern: After the first character (or byte) is output as a 2-digit hex value, the remaining characters are output as the difference between the previous character and the current character. I’m sure this type of encoding has an official name, but it’s the holidays and I’m too lazy to look it up.
Continue reading
Parsing Words with the strspn() Function
I’ve dabbled on the topic of parsing words from a string several times on this blog: Slicing Words from a String, Parse and Count Words in a String, and more. I just can’t have enough! In fact, this Lesson picks up the topic again, continuing my discussion of the strspn() and strcspn() functions from last week’s Lesson.
Continue reading
Encoding a String
Difficulty: Medium
Here is your message:
48190F0009A72827FDFDFBFD18FAAD460CFDFEB323EA192903BB1731F800FCFC0E97
Continue reading