C

C Blog

C Programming

NCurses

XML and JSON

Curl

Online Training

Bookstore

C For Dummies Blog

Main menu

Skip to primary content
Skip to secondary content
  • Home
  • Blog Miscellany
    • History
    • Registration
    • Posting Code in a Comment
  • Supplemental
    • Preprocessor Directives
    • Command Line Programming
  • Series

Category Archives: Lesson

Post navigation

← Older posts

Chatting with a Thread

Posted on July 2, 2022 by dgookin
Reply

A launched thread can be passed an argument, similar to any function. And the thread can return a value, just like any function. But while the thread runs, options for communications are rather limited.
Continue reading →

Posted in Lesson | Leave a reply

Introduction to Pipes

Posted on June 25, 2022 by dgookin
Reply

If you’re like me, you’re probably more familiar with the concept of pipes at the command prompt than in a programming environment. Or maybe you don’t care either way. Regardless, both types of pipe are similar forms of communications, but programming pipes seem specifically weird to me.
Continue reading →

Posted in Lesson | Leave a reply

The Thread Must Die!

Posted on June 18, 2022 by dgookin
Reply

A thread ends in one of three ways: natural causes, an early exit, or sudden death. Yes, it’s exciting, but no more than any aspect of programming.
Continue reading →

Posted in Lesson | Leave a reply

Leaving a Thread Early

Posted on June 11, 2022 by dgookin
Reply

Threads in your code go off and do their own thing, running independently from other parts of the code. Still, the thread is established as a function in your source code file. Like any function, it can leave early.
Continue reading →

Posted in Lesson | Leave a reply

Multiple Thread Mania

Posted on June 4, 2022 by dgookin
Reply

In last week’s Lesson, a program spawned a single thread. This thread runs at the same time as the main program, interrupting text input (if you let it). Such fun! But a multithreaded program isn’t limited to running just two threads. Your code can spawn multiple threads, each running simultaneously.
Continue reading →

Posted in Lesson | Leave a reply

Here a Thread, There a Thread

Posted on May 28, 2022 by dgookin
Reply

Better than forking — especially grandchild forking — is to use threads. These program chunks are more manageable than forking and they don’t recreate the entire program (process). Still, threads aren’t without their quirks. Further, they’re available only to the POSIX standard. Sorry, Windows.
Continue reading →

Posted in Lesson | Leave a reply

Forking the Grandchildren

Posted on May 21, 2022 by dgookin
Reply

I wrote about forking a while back, in June 2015. The fork splits a program into two processes, each capable of handling different tasks simultaneously. The power behind this trick is the fork() function.
Continue reading →

Posted in Lesson | Leave a reply

From Decimal Value to a String

Posted on May 14, 2022 by dgookin
3

The challenge for this month’s Exercise is to split a decimal value into its integer and fractional portions. But what if you need the fractional portion as a string?
Continue reading →

Posted in Lesson | 3 Replies

Conditional Expressions Used as Values

Posted on May 7, 2022 by dgookin
Reply

It was weird when I first saw it: A conditional expression used to determine a value. It sounds odd, but it works.
Continue reading →

Posted in Lesson | Leave a reply

Outputting an Unterminated Buffer

Posted on April 30, 2022 by dgookin
Reply

Properly formed strings in C are terminated with the null character, \0. Accept it or die!

However . . .
Continue reading →

Posted in Lesson | Leave a reply

Post navigation

← Older posts

Recent Posts

  • Chatting with a Thread
  • Your Own Version of left-pad()
  • Introduction to Pipes
  • The Thread Must Die!
  • Leaving a Thread Early

Recent Comments

  • dgookin on Your Own Version of left-pad()
  • Chris Webb on Your Own Version of left-pad()
  • dgookin on The Elevator Ride
  • Chris Webb on The Elevator Ride
  • dgookin on From Decimal Value to a String

Meta

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

Copyright © 1997-2022 by QPBC.
All rights reserved