Posts

Aos

Program 1: (system call unix os) #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <sys/stat.h> #include <dirent.h> #include <errno.h> int main() {     // Print the current process ID     printf("Current process PID: %d\n", getpid());     // Perform directory operations     DIR *dir;     struct dirent *entry;     struct stat file_stat;     dir = opendir(".");     if (dir == NULL) {         perror("opendir failed");         exit(EXIT_FAILURE);     }     // Read directory entries     while ((entry = readdir(dir)) != NULL) {         // Print the name of the file       ...