Of all the common file formats, the CSV is probably the oldest one still in use. It’s a plain text file, so the formatted data appears is readable by humans: Each line is a record. Each field is separated by a single comma.
Continue reading
Manipulate Pointers in Functions, Part III
I know C programmers who make it their goal to avoid pointers — even where necessary. It’s possible to do so, and many have cheat sheets to help them. Then comes the ** pointer monster, which can be avoided altogether . . . until you need to manipulate a pointer variable’s own address within a function. Then you’re cursed.
Continue reading
Manipulate Pointers in Functions, Part II
When a function must manipulate a pointer’s address, the argument passed is a pointer-pointer, not a pointer. Confused? Oh, I’m just getting started . . .
Continue reading
Manipulate Pointers in Functions, Part I
It’s common to pass a pointer to a function. Within the function, you can manipulate the data the pointer references without having to return that data from the function. This aspect of a pointer is what makes C a powerful — and scary — programming language. But what about when you need to manipulate the pointer’s address in the function?
Continue reading
Find the Error: Pointers, Structures, and Files – Solution
It took me a while to figure out what was wrong with this month’s Exercise file. It became an obsession! Of course, I was working with a more complex version — the original code. In that code, the information is written several times to the file, and it becomes very obvious that something is wrong. But when the data is written only once, it’s tough to know whether a problem exists.
Continue reading
Comparing Three Items
Logic can be frustrating, especially for non-Vulcans. The computer is kind of a Vulcan, so logic comes naturally to the machine. Programming languages are packed with logical expressions. A programmer’s duty is to convert human thoughts into the raw, powerful logic the computer understands — and end up with the desired result.
Continue reading
Find the Error: Pointers, Structures, and Files
This month’s Exercise was originally how to create a structure pointer, fill it with data, and write that data to a file. It’s a procedure fraught with traps and peril. What’s even more challenging is when you’re presented with this type of code and it doesn’t work, but it’s your job to fix it.
Continue reading
From Text to Hex
In last week’s Lesson, I showed a program that translates a string of hex values into ASCII text. This code was to sate the nerd in me so that when another nerd writes 48 65 6c 6c 6f 2c 20 66 65 6c 6c 6f 77 20 6e 65 72 64 21, I can respond accordingly. But to respond in hex, a second program is required, one that translates ASCII text into a string of hex values.
Continue reading
From Hex to Text
Do you speak hex? As a programmer, do you look at 0xF and see 1111 in binary? Do you see 15 decimal? What about the ASCII code? Do you know the letter for code 0x41? Are you that good?
Continue reading
Behold the Stack, Part V
Pulling in all the stack items mentioned in last week’s Lesson, I present to you a C program that emulates stack storage. I’m certain this presentation will be one of the highlights of your programming career.
Continue reading