Automatically generated by Pod::Man 2.22 (Pod::Simple 3.07)
Standard preamble:
========================================================================
..
.... Set up some character translations and predefined strings. \*(-- will
give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
double quote, and \*(R" will give a right double quote. \*(C+ will
give a nicer C++. Capital omega is used to do unbreakable dashes and
therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
nothing in troff, for use with C<>.
.tr \(*W- . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\}
Escape single quotes in literal strings from groff's Unicode transform.
If the F register is turned on, we'll generate index entries on stderr for
titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
entries marked with X<> in POD. Of course, you'll have to process the
output yourself in some meaningful fashion.
. de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} . de IX .. .\}
Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] .\} . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents . \" corrections for vroff . \" for low resolution devices (crt and lpr) \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} ========================================================================
Title "BIO_s_file 3"
way too many mistakes in technical documents.
Calls to BIO_read() and BIO_write() read and write data to the underlying stream. BIO_gets() and BIO_puts() are supported on file BIOs.
\fIBIO_flush() on a file \s-1BIO\s0 calls the fflush() function on the wrapped stream.
\fIBIO_reset() attempts to change the file pointer to the start of file using fseek(stream, 0, 0).
\fIBIO_seek() sets the file pointer to position ofs from start of file using fseek(stream, ofs, 0).
\fIBIO_eof() calls feof().
Setting the \s-1BIO_CLOSE\s0 flag calls fclose() on the stream when the \s-1BIO\s0 is freed.
\fIBIO_new_file() creates a new file \s-1BIO\s0 with mode mode the meaning of mode is the same as the stdio function fopen(). The \s-1BIO_CLOSE\s0 flag is set on the returned \s-1BIO\s0.
\fIBIO_new_fp() creates a file \s-1BIO\s0 wrapping stream. Flags can be: \s-1BIO_CLOSE\s0, \s-1BIO_NOCLOSE\s0 (the close flag) \s-1BIO_FP_TEXT\s0 (sets the underlying stream to text mode, default is binary: this only has any effect under Win32).
\fIBIO_set_fp() set the fp of a file \s-1BIO\s0 to fp. flags has the same meaning as in BIO_new_fp(), it is a macro.
\fIBIO_get_fp() retrieves the fp of a file \s-1BIO\s0, it is a macro.
\fIBIO_seek() is a macro that sets the position pointer to offset bytes from the start of file.
\fIBIO_tell() returns the value of the position pointer.
\fIBIO_read_filename(), BIO_write_filename(), BIO_append_filename() and \fIBIO_rw_filename() set the file \s-1BIO\s0 b to use file name for reading, writing, append or read write respectively.
Because the file \s-1BIO\s0 calls the underlying stdio functions any quirks in stdio behaviour will be mirrored by the corresponding \s-1BIO\s0.
.Vb 3 BIO *bio_out; bio_out = BIO_new_fp(stdout, BIO_NOCLOSE); BIO_printf(bio_out, "Hello World\en"); .Ve
Alternative technique:
.Vb 5 BIO *bio_out; bio_out = BIO_new(BIO_s_file()); if(bio_out == NULL) /* Error ... */ if(!BIO_set_fp(bio_out, stdout, BIO_NOCLOSE)) /* Error ... */ BIO_printf(bio_out, "Hello World\en"); .Ve
Write to a file:
.Vb 5 BIO *out; out = BIO_new_file("filename.txt", "w"); if(!out) /* Error occurred */ BIO_printf(out, "Hello World\en"); BIO_free(out); .Ve
Alternative technique:
.Vb 6 BIO *out; out = BIO_new(BIO_s_file()); if(out == NULL) /* Error ... */ if(!BIO_write_filename(out, "filename.txt")) /* Error ... */ BIO_printf(out, "Hello World\en"); BIO_free(out); .Ve
\fIBIO_new_file() and BIO_new_fp() return a file \s-1BIO\s0 or \s-1NULL\s0 if an error occurred.
\fIBIO_set_fp() and BIO_get_fp() return 1 for success or 0 for failure (although the current implementation never return 0).
\fIBIO_seek() returns the same value as the underlying fseek() function: 0 for success or -1 for failure.
\fIBIO_tell() returns the current file position.
\fIBIO_read_filename(), BIO_write_filename(), BIO_append_filename() and \fIBIO_rw_filename() return 1 for success or 0 for failure.