Skip to primary content
Skip to secondary content

C For Dummies Blog

Main menu

  • C For Dummies (home)
  • History
  • Series
  • Supplemental
  • Blog Miscellany

Category Archives: Lesson

Post navigation

← Older posts
Newer posts →

An Update to My strcasecmp() Function

Posted on March 13, 2021 by dgookin
Reply

Many moons ago, I wrote about the non-standard function, strcasecmp(). It works like the C library function strcmp(), though it ignores character case. Turns out my return value from the function isn’t exactly correct.
Continue reading →

Posted in Lesson | Leave a reply

Manual time_t Values and Time Zones

Posted on March 6, 2021 by dgookin
Reply

The 16-hour puzzle presented in last week’s Lesson has been resolved: It was actually a 24-hour puzzle, minus 8 hours for my time zone, which equals 16 hours. But what can be done about the time zone difference?
Continue reading →

Posted in Lesson | Leave a reply

The time_t Value . . . and 16 Hours?

Posted on February 27, 2021 by dgookin
Reply

In last week’s Lesson, I covered the mechanics behind manually calculating a time_t value. My code was successful, but in a curious way.
Continue reading →

Posted in Lesson | Leave a reply

Creating a time_t Value

Posted on February 20, 2021 by dgookin
3

Ho boy! This time_t project turned out to be a lot more complex than I thought it would be!

The problem: Count the number of seconds elapsed from January 1, 1970 to a given year, month, and day. This task is easy for a computer, but not that easy to code if you want to get the value correct.
Continue reading →

Posted in Lesson | 3 Replies

Parsing Integer Values Into a time_t Value

Posted on February 13, 2021 by dgookin
2

Pulling a date from a string involves slicing the string into substrings, which are then converted into values for year, month, and day. Last week’s Lesson demonstrated such code. This week, the final step is accomplished, converting year, month, and day integers into a time_t value.
Continue reading →

Posted in Lesson | 2 Replies

Parsing and Converting

Posted on February 6, 2021 by dgookin
2

The goal stated in last week’s Lesson is to convert a date formatted in a filename string into a time_t value. The filename string must be scanned for expected year, month, and date values. This process involves a custom function, convert(), as well as the strtol() function to translate strings of digits into long int values.
Continue reading →

Posted in Lesson | 2 Replies

It’s Parsing Time

Posted on January 30, 2021 by dgookin
Reply

A recent puzzle presented itself, one where I must extract a date based on a file’s name. The date is part of the name, but my code required I translate the date into a time_t value. It’s an awesome programming puzzle that involves many different tricks.
Continue reading →

Posted in Lesson | Leave a reply

The 27th International Obfuscated C Code Contest

Posted on January 23, 2021 by dgookin
Reply

The results of the 27th International Obfuscated C Code Contest were announced earlier this month. The code is amazing. It runs. It’s horrifyingly cryptic.
Continue reading →

Posted in Lesson | Leave a reply

Compiler Options in Code::Blocks

Posted on January 16, 2021 by dgookin
Reply

Like all IDEs, Code::Blocks is effectively a front for the clang, minGW, or gcc compiler lurking somewhere under its skin. While you don’t use these command line tools directly, you can control their options and settings from within the IDE.
Continue reading →

Posted in Lesson | Leave a reply

Compiler Options at the Command Prompt

Posted on January 9, 2021 by dgookin
3

The traditional C compiler is cc. Its GNU replacement in the Linux world is gcc. A better option is the LLVM clang compiler. As commands typed at a prompt, you control these compilers by setting command line options or switches.
Continue reading →

Posted in Lesson | 3 Replies

Post navigation

← Older posts
Newer posts →

Recent Posts

  • What is the Largest Value?
  • Accessing the Mouse in a Terminal Window
  • Storing and Interpreting Mouse Input
  • Where is the Mouse?
  • Pulling Numbers from a String – Solution

Recent Comments

  • dgookin on Reading Raw Input
  • Chris Webb on Reading Raw Input
  • dgookin on Is It a “Real” Triangle? – Solution
  • Chris Webb on Is It a “Real” Triangle? – Solution
  • dgookin on A Colorful Hexdump

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org

Copyright © 1997-2026 by QPBC.
All rights reserved

Proudly powered by WordPress