For some reason my wc output has only one whitespace character at the end of its output instead of - as assumed in this function - two. This caused the following exception to be raised:
terminate called after throwing an instance of 'std::invalid_argument'
what(): stoi
My understanding is that the idea behind the pop_back() calls are to trim the whitespace from the end of the command output, so I've replaced this with an implementation that should not depend on the exact number of whitespace characters.
For some reason my
wc
output has only one whitespace character at the end of its output instead of - as assumed in this function - two. This caused the following exception to be raised:My understanding is that the idea behind the
pop_back()
calls are to trim the whitespace from the end of the command output, so I've replaced this with an implementation that should not depend on the exact number of whitespace characters.