Posts

Showing posts from September, 2025

Multithreaded wc

Image
A common utility in Linux and Unix systems is the wc program which is used to count the number of lines, words and characters in the files provided as input.  In this blog we will create a multithreaded version of the wc command where each thread will be responsible for finding the count of the lines, words and characters in one file, and then update the common shared variables for the total lines, words and characters across files. Note: The purpose of this blog is to use threads in a bare bones implementation of wc.

stdio Buffers

Image
stdio Buffers in C What if you want to write a program that displays the classic busy indicator (commonly called a spinner) in C? You can use the '\b' escape sequence to delete the previous character on most terminals and wait for around 1 second before printing the next character. Will this work though?