Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <sys/wait.h>
- #include <unistd.h>
- #include <stdio.h>
- #include<string.h>
- #include <stdlib.h>
- #include <fcntl.h>
- int main()
- {
- printf("Opening for read!!!\n");
- int file1=open("file1",O_RDONLY);
- printf("Opening for read!!!A\n");
- int file2=open("file2",O_WRONLY);
- int i=0;
- printf("Opening for read!!!1\n");
- read(file1,&i,sizeof(int));
- while (i<=100)
- {
- i++;
- write(file2,&i,sizeof(int));
- printf("%d\n\t",i);
- }
- printf("Opening for read!!!3\n");
- close(file1);
- close(file2);
- return 0;
- }
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <sys/wait.h>
- #include <unistd.h>
- #include <stdio.h>
- #include<string.h>
- #include <stdlib.h>
- #include <fcntl.h>
- int main()
- {
- printf("Opening for read!!!\n");
- int file1=open("file1",O_WRONLY);
- printf("Opening for read!!!A\n");
- int file2=open("file2",O_RDONLY);
- // int file2=open("file2",O_iRDONLY);
- int i=0;
- printf("Opening for read1!!!\n");
- read(file2,&i,sizeof(int));
- printf("Opening for read!!!4\n");
- while (i<=100)
- {
- i++;
- write(file1,&i,sizeof(int));
- printf("%d\n\t",i);
- }
- printf("Opening for read!!!2\n");
- close(file2);
- close(file1);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement