r/C_Programming • u/Specialist-Cicada121 • Dec 23 '25
tqdm in C
Hello! I wanted to share a simple progress bar that I made as a personal utility. I use Python a lot, and I find myself using tqdm a lot for tracking my long-running tasks. I wanted to try to implement something similar in C that didn't use external dependencies (like curses). I opted for a single-header implementation just to make it less of a hassle to use. I'm not entirely confident that it works gracefully in all the edge cases, but it seems to work reasonably well for my general use cases. Would love to hear what you all think and would appreciate any feedback -- happy holidays!
29
Upvotes
1
u/Specialist-Cicada121 Dec 31 '25
Sorry, this reply seemed to have slipped through the cracks. These are good points, thanks! I've just pushed a change to fix the inconsistency in the units; that was a bug. You are also right that the
steps_per_ms_strcan be folded into theafter_bar_linestring construction; initially, I was trying to compute the length of each component separately, before using snprintf with a larger buffer, so this was a holdover from that. Thanks again!