I am using system("ls *") to list all the files under c++. This function only returns an integer, and I am wondering whether there is a simliar function which can return the output string. Thanks.
What system() does is basically act as though you had typed in that command into the command prompt. It displayed everything just like it would if you had done so. I suppose you could use piping to get the results to a file and read it, but I personally think it would be better just to use your OS's API or another abstraction layer (like boost) to get at the directory information.