BIO_s_file() This is the FILE pointer BIO object. Uses FILE *; the file pointer is actually kept in BIO->ptr. This source/sink is in theory bi-directional but it depends on the FILE * and how it was opened. Non-blocking IO is not supported. A file pointer needs to be assigned before any IO operations should be made. So normally: bio=BIO_new(BIO_s_file()); BIO_set_fp(bio,stderr,BIO_NOCLOSE); or bio=BIO_new(BIO_s_file()); BIO_read_filename(bio,"infile"); BIO_read and BIO_write do not implement the 'pending' operations used for non-blocking IO. BIO_gets does a fgets. BIO_puts does a fwrite(). BIO_CTRL_RESET does a fseek() back to the start of the file. BIO_CTRL_EOF does a feof(). BIO_CTRL_INFO does a ftell(). BIO_CTRL_SET assigned the FILE * and close flag. BIO_CTRL_GET returns the FILE * via the ptr parameter (FILE **). BIO_CTRL_GET_CLOSE/BIO_CTRL_SET_CLOSE returns and sets the close on free flag. BIO_CTRL_PUSH returns 0, does nothing. BIO_CTRL_POP returns 0, does nothing. BIO_CTRL_PENDING unimplemented, returns 0. BIO_CTRL_FLUSH fflush()es the FILE *. BIO_CTRL_SHOULD_RETRY/BIO_CTRL_RETRY_TYPE unimplemented, returns 0. BIO_CTRL_SET_FILENAME is a special case. The file name is opened and used. This is a special case. .