Better just use "strip", to be sure \r\n is also stripped. This also corresponds to what happens with popen() results.