Search This Blog

C Program to Remove (Delete) a Directory using LINUX System Calls

This is a C program to delete  or remove a directory using the system calls in Linux or Unix operating systems. The program make use of the remove() system call in Linux.

#include<stdio.h>
#include<fcntl.h>
main()
{



char fn[10];
printf("Enter source filename\n");
scanf("%s",fn);
if(remove(fn)==0)
printf("File removed\n");
else
printf("File cannot be removed\n");
}

No comments: