C and concatenating strings…

subetha rLov1Y

Imagine running across a block of C code that is meant to create a comma separated list of items like this: 2024/10/18,12:30:06,100,0.00,0,0,0,902.0,902.0,928.0,31.75,0,0,100 …2024/10/18,12:30:07,100,0.00,0,0,0,902.0,902.0,928.0,31.75,0,0,100 …2024/10/18,12:30:08,100,0.00,0,0,0,902.0,902.0,928.0,31.75,0,0,100 …2024/10/18,12:30:09,100,0.00,0,0,0,902.0,902.0,928.0,31.75,0,0,100 … And the code that does it was modular, so new items could be inserted anywhere, easily. This is quite flexible: snprintf (buffer, BUFFER_LENGTH, “%u”, …

Read More

From: Retro Roundup