Manual Pages for UNIX Darwin command on man BIO_append_filename
MyWebUniversity

Manual Pages for UNIX Darwin command on man BIO_append_filename

BIOsfile(3) OpenSSL BIOsfile(3)

NAME

BIOsfile, BIOnewfile, BIOnewfp, BIOsetfp, BIOgetfp, BIOreadfilename, BIOwritefilename, BIOappendfilename,

BIOrwfilename - FILE bio

SYNOPSIS

#include

BIOMETHOD * BIOsfile(void); BIO *BIOnewfile(const char *filename, const char *mode); BIO *BIOnewfp(FILE *stream, int flags); BIOsetfp(BIO *b,FILE *fp, int flags); BIOgetfp(BIO *b,FILE **fpp); int BIOreadfilename(BIO *b, char *name) int BIOwritefilename(BIO *b, char *name) int BIOappendfilename(BIO *b, char *name) int BIOrwfilename(BIO *b, char *name)

DESCRIPTION

BIOsfile() returns the BIO file method. As its name implies it is a wrapper round the stdio FILE structure and it is a source/sink BIO. Calls to BIOread() and BIOwrite() read and write data to the underlying stream. BIOgets() and BIOputs() are supported on file BIOs. BIOflush() on a file BIO calls the fflush() function on the wrapped stream. BIOreset() attempts to change the file pointer to the start of file using fseek(stream, 0, 0). BIOseek() sets the file pointer to position ooffss from start of file using fseek(stream, ofs, 0). BIOeof() calls feof(). Setting the BIOCLOSE flag calls fclose() on the stream when the BIO is freed. BIOnewfile() creates a new file BIO with mode mmooddee the meaning of mmooddee is the same as the stdio function fopen(). The BIOCLOSE flag is set on the returned BIO. BIOnewfp() creates a file BIO wrapping ssttrreeaamm. Flags can be: BIOCLOSE, BIONOCLOSE (the close flag) BIOFPTEXT (sets the underlying stream to text mode, default is binary: this only has any effect under Win32). BIOsetfp() set the fp of a file BIO to ffpp. ffllaaggss has the same meaning as in BIOnewfp(), it is a macro. BIOgetfp() retrieves the fp of a file BIO, it is a macro. BIOseek() is a macro that sets the position pointer to ooffffsseett bytes from the start of file. BIOtell() returns the value of the position pointer. BIOreadfilename(), BIOwritefilename(), BIOappendfilename() and BIOrwfilename() set the file BIO bb to use file nnaammee for reading, writing, append or read write respectively. NNOOTTEESS When wrapping stdout, stdin or stderr the underlying stream should not normally be closed so the BIONOCLOSE flag should be set. Because the file BIO calls the underlying stdio functions any quirks in stdio behaviour will be mirrored by the corresponding BIO. EEXXAAMMPPLLEESS File BIO "hello world": BIO *bioout; bioout = BIOnewfp(stdout, BIONOCLOSE); BIOprintf(bioout, "Hello World\n"); Alternative technique: BIO *bioout; bioout = BIOnew(BIOsfile()); if(bioout == NULL) /* Error ... */ if(!BIOsetfp(bioout, stdout, BIONOCLOSE)) /* Error ... */ BIOprintf(bioout, "Hello World\n"); Write to a file: BIO *out; out = BIOnewfile("filename.txt", "w"); if(!out) /* Error occurred */ BIOprintf(out, "Hello World\n"); BIOfree(out); Alternative technique: BIO *out; out = BIOnew(BIOsfile()); if(out == NULL) /* Error ... */ if(!BIOwritefilename(out, "filename.txt")) /* Error ... */ BIOprintf(out, "Hello World\n"); BIOfree(out);

RETURN VALUES

BIOsfile() returns the file BIO method. BIOnewfile() and BIOnewfp() return a file BIO or NULL if an error occurred. BIOsetfp() and BIOgetfp() return 1 for success or 0 for failure (although the current implementation never return 0). BIOseek() returns the same value as the underlying fseek() function: 0

for success or -1 for failure.

BIOtell() returns the current file position. BIOreadfilename(), BIOwritefilename(), BIOappendfilename() and BIOrwfilename() return 1 for success or 0 for failure.

BUGS

BIOreset() and BIOseek() are implemented using fseek() on the

underlying stream. The return value for fseek() is 0 for success or -1

if an error occurred this differs from other types of BIO which will typically return 1 for success and a non positive value if an error occurred.

SEE ALSO

BIOseek(3), BIOtell(3), BIOreset(3), BIOflush(3), BIOread(3), BIOwrite(3), BIOputs(3), BIOgets(3), BIOprintf(3), BIOsetclose(3), BIOgetclose(3)

0.9.7l 2000-09-18 BIOsfile(3)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™