i want to restrict some website for getting open on osx. I can do it through terminal commands as:
sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /etc/hosts
then we can easly edit and save this file.just we can write local ip and website name to be restrict this website as 192.0.0.1 www.youtube.com. I want to do it programmatically, i tried as follows:
system("echo \"192.0.0.1 www.facebook.com\" >> /etc/hosts");
this application having root privileges still it is not able to append it and displaying permission denied message.
can any one tell me what is the problem, or is there any other way to edit this file /etc/hosts