Similar to the Linux command, c language has a chmod function to modify file permissions:
#include <sys/stat.h> int chmod(const char *path, mode_t mode);