You find the '='
via strchr()
.
Loop from there until you hit either '\0'
or '#'
. Count the loops. Inside the loop, check for first non-blankspace (isspace()
), and keep in mind (i.e., a variable) where you found it.
After the loop, you have all the information you need: Copy (starting from remembered position of first non-blank) a number of bytes equal ( number of loops - position of first non-blank ).
That being said, once you're out of tutorial / C in 21 days country, you should really use ready-made libraries for stuff like this..