Getting root privileges by software in C

I want to mount a CDROM by software. rbr ( an linux expert ) explain how to do this by software using the mount command but I see in the man page that I must be root. I do not want to be root when running my prog, I want to be an user so my question is : how can I get root permission to mount filesystem, access to the input/output ports using inp, out ...?
Who is Participating?
ResonanceConnect With a Mentor Commented:
You cannot gain root permissions from inside a program that is not either run as root or setuid root.  However, you can make your cdrom mountable by users by placing it in /etc/fstab

Adding the following line (it's all on one line, so be careful if you see it wrapped) to /etc/fstab will make /dev/cdrom mountable by all users, but will not automount on boot.

/dev/cdrom      /cdrom  iso9660 user,noauto,ro
All Courses

From novice to tech pro — start learning today.