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" '' . ds C` . ds C' 'br\}
Escape single quotes in literal strings from groff's Unicode transform.
If the F register is >0, 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.
Avoid warning from groff about undefined register 'F'.
.. .nr rF 0 . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF 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 3ossl"
way too many mistakes in technical documents.
Calls to BIO_read_ex() and BIO_write_ex() read and write data to the underlying stream. BIO_gets() and BIO_puts() are supported on file BIOs.
\fBBIO_flush() on a file \s-1BIO\s0 calls the fflush() function on the wrapped stream.
\fBBIO_reset() attempts to change the file pointer to the start of file using fseek(stream, 0, 0).
\fBBIO_seek() sets the file pointer to position ofs from start of file using fseek(stream, ofs, 0).
\fBBIO_eof() calls feof().
Setting the \s-1BIO_CLOSE\s0 flag calls fclose() on the stream when the \s-1BIO\s0 is freed.
\fBBIO_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
\fBBIO_new_fp() creates a file \s-1BIO\s0 wrapping stream. Flags can be: \s-1BIO_CLOSE, BIO_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).
\fBBIO_set_fp() sets the fp of a file \s-1BIO\s0 to fp. flags has the same meaning as in BIO_new_fp(), it is a macro.
\fBBIO_get_fp() retrieves the fp of a file \s-1BIO,\s0 it is a macro.
\fBBIO_seek() is a macro that sets the position pointer to offset bytes from the start of file.
\fBBIO_tell() returns the value of the position pointer.
\fBBIO_read_filename(), BIO_write_filename(), BIO_append_filename() and \fBBIO_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
On Windows BIO_new_files reserves for the filename argument to be \s-1UTF-8\s0 encoded. In other words if you have to make it work in multi- lingual environment, encode filenames in \s-1UTF-8.\s0
\fBBIO_new_file() and BIO_new_fp() return a file \s-1BIO\s0 or \s-1NULL\s0 if an error occurred.
\fBBIO_set_fp() and BIO_get_fp() return 1 for success or <=0 for failure (although the current implementation never return 0).
\fBBIO_seek() returns 0 for success or negative values for failure.
\fBBIO_tell() returns the current file position or negative values for failure.
\fBBIO_read_filename(), BIO_write_filename(), BIO_append_filename() and \fBBIO_rw_filename() return 1 for success or <=0 for failure.
.Vb 1 BIO *bio_out; \& bio_out = BIO_new_fp(stdout, BIO_NOCLOSE); BIO_printf(bio_out, "Hello World\en"); .Ve
Alternative technique:
.Vb 1 BIO *bio_out; \& bio_out = BIO_new(BIO_s_file()); if (bio_out == NULL) /* Error */ if (BIO_set_fp(bio_out, stdout, BIO_NOCLOSE) <= 0) /* Error */ BIO_printf(bio_out, "Hello World\en"); .Ve
Write to a file:
.Vb 1 BIO *out; \& out = BIO_new_file("filename.txt", "w"); if (!out) /* Error */ BIO_printf(out, "Hello World\en"); BIO_free(out); .Ve
Alternative technique:
.Vb 1 BIO *out; \& out = BIO_new(BIO_s_file()); if (out == NULL) /* Error */ if (BIO_write_filename(out, "filename.txt") <= 0) /* Error */ BIO_printf(out, "Hello World\en"); BIO_free(out); .Ve
Licensed under the Apache License 2.0 (the \*(L"License\*(R"). You may not use this file except in compliance with the License. You can obtain a copy in the file \s-1LICENSE\s0 in the source distribution or at <https://www.openssl.org/source/license.html>.