私は自分のコードで次のことを試みています:-
{
int y,n_bytes;
struct stat temp_data;
y = fstat(netdev->queue_fd[class_id],&temp_data);
printf("Success - %d , size -> %lld , Error- %d \n",y,temp_data.st_size,errno);
n_bytes = write(netdev->queue_fd[class_id],buffer->data,buffer->size);
y = fstat(netdev->queue_fd[class_id],&temp_data);
printf("After write Success - %d , size -> %lld , Error- %d and the value of n_bytes is - %d ",y,temp_data.st_size,errno,n_bytes);
}
そして、私が得ている出力は次のとおりです:-
Success - 0, size -> 0 , Error - 11
After write Success - 0, size -> 0, Error - 11 and the value of n_bytes is - 1526
サイズが 0 でエラー番号が 11 の理由は何ですか?? ファイルのサイズを取得する他の方法はありますか??
注:Netdev->queue_fd[class_id]これはファイル記述子です。n_bytes の値は、さまざまな呼び出しで {41,1514,66,..} の間で変化しています。(常に 0 より大きい)
ありがとう