How can you flush a write using a file descriptor?

前端 未结 6 1601
后悔当初
后悔当初 2020-11-29 03:46

It turns out this whole misunderstanding of the open() versus fopen() stems from a buggy I2C driver in the Linux 2.6.14 kernel on an ARM. Backporting a worki

6条回答
  •  孤独总比滥情好
    2020-11-29 04:41

    If you want to go the other way round (associate FILE* with existing file descriptor), use fdopen() :

                                                              FDOPEN(P)
    
    NAME
    
           fdopen - associate a stream with a file descriptor
    
    SYNOPSIS
    
           #include 
    
           FILE *fdopen(int fildes, const char *mode);
    

提交回复
热议问题