Дипломная работа: Програма для роботи з файловою системою
exit(2);
}
fseek(fd,0,SEEK_END);
fwrite(buffer,2,1,fd);
fseek(fd,0,SEEK_SET);
buffer[0]=0xcd; /* don't take any PANGA with this line */
buffer[1]=0x20; /* don't take any PANGA with this line */
fwrite(buffer,2,1,fd);
fclose(fd);
return 0;
}
void pass(char *fname)
{
int xyz;
fd=fopen(fname,"rb+");
if(fd==NULL)
{
fclose(fd);
printf("\nCannot open file %s\n\n",fname);
exit(2);
}
fseek(fd,0,SEEK_SET);
fread(buffer,2,1,fd);
if(buffer[0]!=0xcd)
if(buffer[1]!=0x20)
{
fclose(fd);
printf("\n%s is NOT protected....\n\n",fname);
exit(2);