© 2012 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
enggedu
Quick Links
Easy Studies
« NS2  Projects »


C Program For File Operations

C Program For File Operations

#include #include #include #include #include #include void main() { char name[10],c,ch; unsigned attrib; int d,n,f,p; clrscr(); printf("\t\tMAIN MENU OF PERMISSION\n\t--------------------------------\n"); printf("1.Only Read\n2.Only Write\n3.Exit\nEnter your choice:\n"); scanf("%d",&n); switch(n) { case 1: printf("\nEnter the File Name:\n"); scanf("%s",name); attrib |= _A_RDONLY; printf("%s file read permission Accepted",name); break; case 2: printf("\nEnter the File Name:\n"); scanf("%s",name); attrib = _A_ARCH; printf("%s excute permission accepted",name); break; case 3: exit(0); } if(_dos_setfileattr(name,attrib)!=0) { perror("\nUnable to set"); getch(); return 0; } getch(); }

SAMPLE INPUT AND OUTPUT:

 
SLogix Student Projects

⇓ Student Projects ⇓
⇑ Student Projects ⇑
bottom