Checking if device is mounted..

Hi,
I want to check if a device is mounted before performing actual mount. I was able to check that using the below C code. But in C++ it is throwing the following error:
" error: invalid conversion from `int' to `const char*' "

C program just generated a warning message, but C++ throws error..

Please let me know if there is any other way to find the mount devices using C++.

int main()
{
if (system('mount | grep "home" >/dev/null') != 0)
     printf("home is mounted\n");
else
     printf("home is not mounted\n");

}

int main()
{
if (system("mount | grep \"home\" >/dev/null") != 0)
     printf("home is mounted\n");
else
     printf("home is not mounted\n");

}

Strings in C/C++ are never single quotes, they're always double-quotes. Try it now.

I believe the return value of 'system(whatever)' signifies a success/failure of 'whatever' being spawned - which is not the same as the return value of 'whatever'.

Manpage on my system says it returns -1 if it can't fork, and returns the return value of the command otherwise.