0

Hi. i'm trying to copy a binary already with a predefined permissions. I got this code:

FILE *f1, *f2;
  char cp;
f1 = fopen("file1","rb");
f2 = fopen("file2","wb");
while(!feof(f1)) {
cp = fgetc(f1);
if(!feof(f1)) fputc(cp, f2);
fclose(f1);
fclose(f2);

but this just copy a file. But what i'm trying to do is copy file for example with permissions 0777.
i saw somewhere that people using something like this:

f1=open("file1",O_RDONLY);
f2=open("file2",O_WRONLY|O_CREAT,0777);

i was trying many ways but always it copy a binary into another which is just empty file. Plz help

3
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by somename
0

thank you for your replies, but i have to deal with it later because now i have devastating exams and absolutely now free time for programming ;(

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.