I am calling 'find' from popen and the string returned contains garbage at the end. Any ideas on how to fix it?
I am trying to compare output of find to a known dynamically created string.
Here's the output and it's self descriptive; else, I will clarify.
1 2 3 4 5 6 7 8 9 10
login cmd: "cd .. && find hi_client/stashedclienthi 2>&1"
About to compare:
hi_client/stashedclienthi
è to hi_client/stashedclienthi
Output comp: 10
comp.c_str(): find: `hi_client/stashedclienthi': No such file or directory
strlen( hi_client/stashedclienthi ) 25 strlen( hi_client/stashedclienthi
è ): 28
It finds the command fine. What I meant is that the output is returned correctly, but with some garbage values appended at the end of the read string. For example, find would return...
<*file found*><garbage> == <filefound>%&$#@`
I wrote a quick hack and kept just the last index, since I already know the ideal output. So, in any case I would compare the right string or a completely different string.