I am trying to ‘prettify’ some code that makes a log file and in the log file I want to print the name of the input files and what settings were used in a nicely formatted #-box. I need to be able to get the length of an entered argument which has to be stored by the GNU getopt somewhere for it’s internal malloc, at least I assume that’s how they did it..
Does anyone know how to get that value? I could then use some simple calculus to see howmuch whitespace that I need to add after the last letter of text in my comment box 😉
Where your code stores the value, it is available in the
variable, and you can simply use
strlen()to compute the length of the string.