C program to know type of file

source code


#include "time.h"
#include "sys\stat.h"
#include "stdio.h"
void main()
{
    struct stat status;
    FILE *fp;
    stat("c:\\tc\\bin",&status);
    clrscr();
    if (status.st_mode & S_IFDIR)
         printf("It is directory.\n");
    if (status.st_mode & S_IFCHR)
         printf("It is chracter file.");
    if (status.st_mode & S_IFREG)
         printf("It is reggular file.");
    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.