You don't need to call the external mount program to mount a drive. Mount is a system call ( sys_mount (21) ) and it's available through sys/mount.h for the user space.
Try
and you'll see :
Code:
#include <sys/mount.h>
int mount(const char *source, const char *target,
const char *filesystemtype, unsigned long mountflags,
const void *data);
int umount(const char *target);
And actually, if you are considering also the situation when CD has a proper ISO filesystem on it but there're no files, then you need to check for the files. My choice would be the opendir and readdir commands. See man 2 readdir and man 3 opendir.