Electronics and Software
Engineering Innovation
Beam-lib  2.15.1

File operations class. More...

#include <BFile.h>

Inheritance diagram for BFile:
BFileCsv

Public Member Functions

 BFile ()
 
 BFile (const BFile &file)
 Create opened specified file. More...
 
 ~BFile ()
 
BError open (BString name, BString mode)
 Open file. More...
 
BError open (FILE *file)
 Assign object to opened file handle. More...
 
BError open (int fd, BString mode)
 Assign object to opened file descriptor. More...
 
BError close ()
 Close file. More...
 
int isOpen ()
 Returns 1 if the file is open. More...
 
int isEnd ()
 Returns 1 if at the end of the file, 0 otherwise. More...
 
FILE * getFd ()
 File descriptor. More...
 
BUInt64 length ()
 File size in bytes. More...
 
int setVBuf (char *buf, int mode, size_t size)
 Set stream buffering options. More...
 
int read (void *buf, int nbytes)
 Read from file. More...
 
int readString (BString &str)
 Read string. (ref fgets) More...
 
char * fgets (char *buf, size_t size)
 
int write (const void *buf, int nbytes)
 Write to file. More...
 
int writeString (const BString &str)
 Write string to file. More...
 
int seek (BUInt64 pos)
 Set seek position. More...
 
BUInt64 position ()
 The files position. More...
 
int printf (const char *fmt,...)
 Formated print into the file. More...
 
BError truncate ()
 Truncate the file. More...
 
BError flush ()
 Flush the file. More...
 
BString fileName ()
 Return file name. More...
 
BFileoperator= (const BFile &file)
 

Private Attributes

FILE * ofile
 
BString ofileName
 
BString omode
 

Detailed Description

File operations class.

Constructor & Destructor Documentation

◆ BFile() [1/2]

BFile::BFile ( )

◆ BFile() [2/2]

BFile::BFile ( const BFile file)

Create opened specified file.

◆ ~BFile()

BFile::~BFile ( )

Member Function Documentation

◆ close()

BError BFile::close ( )

Close file.

◆ fgets()

char * BFile::fgets ( char *  buf,
size_t  size 
)

◆ fileName()

BString BFile::fileName ( )

Return file name.

◆ flush()

BError BFile::flush ( )

Flush the file.

◆ getFd()

FILE * BFile::getFd ( )

File descriptor.

◆ isEnd()

int BFile::isEnd ( )

Returns 1 if at the end of the file, 0 otherwise.

◆ isOpen()

int BFile::isOpen ( )

Returns 1 if the file is open.

◆ length()

BUInt64 BFile::length ( )

File size in bytes.

◆ open() [1/3]

BError BFile::open ( BString  name,
BString  mode 
)

Open file.

◆ open() [2/3]

BError BFile::open ( FILE *  file)

Assign object to opened file handle.

◆ open() [3/3]

BError BFile::open ( int  fd,
BString  mode 
)

Assign object to opened file descriptor.

◆ operator=()

BFile & BFile::operator= ( const BFile file)

◆ position()

BUInt64 BFile::position ( )

The files position.

◆ printf()

int BFile::printf ( const char *  fmt,
  ... 
)

Formated print into the file.

◆ read()

int BFile::read ( void *  buf,
int  nbytes 
)

Read from file.

◆ readString()

int BFile::readString ( BString str)

Read string. (ref fgets)

◆ seek()

int BFile::seek ( BUInt64  pos)

Set seek position.

◆ setVBuf()

int BFile::setVBuf ( char *  buf,
int  mode,
size_t  size 
)

Set stream buffering options.

◆ truncate()

BError BFile::truncate ( )

Truncate the file.

◆ write()

int BFile::write ( const void *  buf,
int  nbytes 
)

Write to file.

◆ writeString()

int BFile::writeString ( const BString str)

Write string to file.

Member Data Documentation

◆ ofile

FILE* BFile::ofile
private

◆ ofileName

BString BFile::ofileName
private

◆ omode

BString BFile::omode
private

The documentation for this class was generated from the following files: