To output graphics, you need a palette. That is, you need a buffer that’s so many pixels wide and rows high. Create the buffer, draw in the buffer, output the buffer. That’s how graphics works, both in graphics as well as text mode.
Continue reading
Category Archives: Lesson
Text Mode Graphics
Graphics programming is entirely possible in the C language.
Continue reading
The Joy of Clang
If it were spelled Klang, then it might be a reference some Klingon character from Star Trek, but it’s not. Clang is one of those program names that’s a contraction. In this instance, it’s a portmanteau of C Language. It’s an über nifty command line compiler.
Continue reading
Word Wrap Filter Repair
As a programmer, always be thinking: What can go wrong? What would be an exception? Where have I made assumptions? You can’t avoid bugs by making such challenges, but you can diminish their possibilities.
Continue reading
Word Wrap Filter Walkthrough
In last week’s Lesson, I presented code that shows one way to wrap incoming streaming text. It’s not the easiest thing. Let me explain how last week’s code attempts to solve the problem.
Continue reading
A Word Wrap Filter
Unlike static text, streaming text feeds into a program one character at a time. To wrap that text, you need to know all the basics about wrapping text (covered in this Lesson), but also how to concoct a filter that buffers its output.
Continue reading
Wrapping Static Text
When displaying a long string of text, it’s polite — and expected — for the programmer to wrap the text. Not wrapping the text would split words at the right margin, which irritates human readers to no end.
Continue reading
Word Wrap Philosophy
Way back in the day, word wrap was fascinating. It was so unique that word processors boasted about it as a feature. I’m serious! That’s because a lot of the primitive (late 1970s and early 1980s) word processing programs did not wrap text at the end of a line. Strange, but true.
Continue reading
Hello, Function!
A basic C language process is passing a value to a function. If you’re an old hand, you might say, “Yeah, well, so?” For a beginning programmer, however, functions and their arguments can be a confusing and intimidating ordeal.
Continue reading
scanf() the Bastard
When you first learn the C language, and you’re practicing basic input/output, you become familiar with the two I/O workhorses of the C library: printf() and scanf(). Of the two, printf() is my favorite. The scanf() function is highly useful, and it’s a great learning tool, but it’s not the best function for reading in a string of text.
Continue reading