ホームAV動画2015Deaikei ShirotoDAGE-856
DAGE-856 写入文件 return 0; } ``` There is a shared file pointer in the main process, and after reclin, the two child processes each have their own file pointers that point to the same file. The two child processes write to the file at the same time, the order is chaotic. Because the order of writing is random for each child process. ```c #include <stdio.h> #include <fcntl> #include <unistd> #include <wait.h> #include <string.h> int main() { int fd = open("test.txt", O_RDWR | O_CREAT, 0777); if (fork() == 0) { //Child process write char *buf = "I am child "; write(fd, buf, strlen(buf)); printf("Child process fork "); } else { int fd = open("test.txt", O_RDWR | O_CREAT, 0777); //Father process write char *buf = "I am father "; write(fd, buf, strlen(buf)); printf("Father process fork "); } return 0; } ``` Now, if you open the file in each process, the order will be correct. Each child process has its own separate file pointer, so they will not interfere with each other. ```c #include <stdio at> #include <fcstl> #include <unistd> #include <wait.h> #include <string.h> int main() { int fd = open("test.txt", O_RDWR | O_CREAT, 0777); if (fork() == 0) { //Child process write int fd = open("test.txt", O_RDWR | O_CRE, 0777); char *buf = "I am child "; write(fd, buf, strlen(buf)); printf("Child process fork "); } else { int fd = open("test.txt", O_RDWR | O_CREAT, 0777); //Father process write char *buf = "I am father " write(fd, buf, strlen(buf)); printf("Father process fork "); } return 0; } ```
動画発売日
収録時間
46 分平均の長さ
メーカー
動画ランキング
284151 / 532183
他の動画 ID
dage856, DAGE856, DAGE 856
女優体型
平均身長, 曲線美, セクシー
無修正
無し
動画言語
日本語
字幕
サブリップ (SRT ファイル)
著作権 ©
DMM
舞台裏 (7画像)
料金
字幕 (キャプション)
英語字幕
中国語字幕
日本語字幕
フランス語字幕