When executing the linux command "mount", with invalid parameters and execute it with the popen() function in my C++ code. The output is empty. I'm expecting an error like this: "mount: mount point test does not exist"
Here is the code that should generate some errors as 'test' doesn't exist:
FILE *file;
char data[512];
if((file = popen("mount test test", "r")))
{
while(fgets(data, sizeof(data), file)!=NULL)
{
printf("%s", data);
}
pclose(file);
}
data array is empty. But when I replace the command "mount test test" with "date" the data array gets filled with the following: "Wed Jan 4 08:20:23 EST 2017".
Thanks if any of you have ideas.