[問題] 請問一個關於read/write的問題
這是一個socket的程式
我節錄部份
s是socket descriptor
我對於stderr以及stdin和stdout不是很了解
他們的path是?或者是什麼情況要用到他們
在receive 的部份
length = read(s, buf, sizeof(buf));
if (length > 0) {
write(1, buf, length);
.....略
}
問題1
請問在此的1代表的是stdout嗎???
將資料從buf write到1(stdout?)
同理 send部分
while ( (length = read(0, buf, size)) > 0 ) {
l = write(s, buf, l);
total += l ;
}
問題2
在此的0代表的是stdin嗎???
那這樣的話 我看不懂 從stdin read到buf 那stdin裡面會是什麼東西
問題3
fprintf(stderr, "socker create error ");
那這樣 我要去哪看stderr log呢(換句話如果他寫到stderr 我怎麼知道)
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.167.77.211
討論串 (同標題文章)
Programming 近期熱門文章
PTT數位生活區 即時熱門文章