the problem that i have is when i ever create a file the Linux operating system sets the the permissions automatically so how do i remove the permissions within the program ?

If you only need support for Linux, you can try using this:

/* Creates a file named "helloworld.txt" in the current directory and sets access permissions to read-only for group */

#include <stdio.h>

#include <sys/stat.h>

char *myfile = "helloworld.txt";

char text[] = "hello";

int main()
{

	FILE *fp;

	fp = fopen(myfile, "w");

	fwrite(text, 1, strlen(text), fp);

	fclose(fp);

	chmod(myfile, S_IRGRP);

return 0;
}

My code doesn't have any error checking of course, but it should provide you with the basic idea.

The thread was marked as solved but I thought I'd post this for others here who might have the same problem anyway...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.