Hanochsunil / lab

0 stars 0 forks source link

forkodd #10

Open Hanochsunil opened 2 months ago

Hanochsunil commented 2 months ago

include

include<sys/types.h>

include<sys/wait.h>

include

void main(){ pid_t p; int a; printf("Enter the range: "); scanf("%d",&a); p=fork(); for(int i=0;i<=a;i++){ if(p == 0){ if(i%2==0){ printf("%d\n",i); } } else if(p > 0){ if(i%2!=0){ printf("%d\n",i); } } } }

Hanochsunil commented 2 months ago

include

include<sys/stat.h>

void main(){ printf("ente the name of the file: "); char f_name[78]; scanf("%s",f_name); struct stat s; stat(f_name,&s); printf("last access time of file: %ld\n", s.st_atime); printf("last modified time: %d\n", s.st_mtime); printf("size of file: %d\n", s.st_size); printf("file mode: %o\n", s.st_mode);