C program to know permission of any file.

source code


#include "time.h"
#include "sys\stat.h"
#include "stdio.h"
void main()
{
    struct stat status;
    FILE *fp;
    stat("test.txt",&status);
    clrscr();
    if (status.st_mode & S_IREAD)
         printf("You have read permission.\n");
    if (status.st_mode & S_IWRITE)
         printf("You have write permission.");
    getch();
}

Comments

Popular posts from this blog

8086 STRING MANIPULATION –FIND AND REPLACE A WORD

Animated Circles In C++

C program to find out the sum of series 1 + 2 + …. + n.