WXP::File Class Reference
[File I/O objects]

This class accesses files. More...

#include "../include/File.h"

Inheritance diagram for WXP::File:
WXP::FileAttr

List of all members.

Public Types

enum  Type {
  REG, PIPE, STDIO, FIFO,
  DEVICE, SOCKETC, SOCKETS, HTTP,
  FTP
}
enum  Format {
  UNK, WXP, NETCDF, GRIB,
  BUFR, UNISYS, NONE
}

Public Member Functions

int init ()
 File (const char *file, const char *raccess)
 File (String &file, const char *raccess)
 File (const char *file, int raccess)
 File ()
 ~File ()
int open (const char *file, const char *raccess)
int open (String &file, const char *raccess)
int open (const char *file, int raccess)
int getLine (char *string, int len)
int getLine (String &string)
int skipLine ()
bool isOpen ()
int rewind ()
int close ()
bool endFile ()
int scanf (const char *fmt,...)
int printf (const char *fmt,...)
int read (unsigned char *buf, int size, int num)
int read (unsigned char *buf, int size)
int read (Buffer &buf, int size)
int read (Buffer &buf)
int write (const unsigned char *buf, int size, int num)
int write (const unsigned char *buf, int size)
int tell ()
int seek (int byte, int where)
int seek (int byte)
FILE * getFP ()

Static Public Member Functions

static int setShare (int mode)

Static Public Attributes

static const int FILE_LENGTH = 100

Detailed Description

This class accesses files.

Author:
Dan Vietor

Constructor & Destructor Documentation

File::File ( const char *  file,
const char *  raccess 
)

Constructor. Opens file with access

Parameters:
file Filename to open
raccess File access (r, w, a, r+, see fopen)

References open().

File::File ( String file,
const char *  raccess 
)

Constructor. Opens file with access

Parameters:
file Filename to open
access File access (r, w, a, r+, see fopen)

References WXP::String::get(), and open().

File::File ( const char *  file,
int  raccess 
)

Constructor. Opens file with access

Parameters:
file Filename to open
raccess File access READ, WRITE, APPEND

References open().

File::File (  ) 

Constructor. Initializes class data

References init().

File::~File (  ) 

Destructor. Closes file

References close().


Member Function Documentation

int File::close (  ) 
bool File::endFile (  ) 
int File::getLine ( String string  ) 

Gets a line from the file

Return values:
string Output string class

References getLine().

int File::getLine ( char *  string,
int  len 
)
int File::init (  ) 

Initializes the class data

References WXP::FileAttr::READ.

Referenced by File(), and open().

bool File::isOpen (  ) 
int File::open ( const char *  file,
int  raccess 
)

Opens file with access

Parameters:
file Filename to open
raccess File access READ, WRITE, APPEND

References WXP::FileAttr::APPEND, open(), WXP::FileAttr::READ, and WXP::FileAttr::WRITE.

int File::open ( String file,
const char *  raccess 
)

Opens file with access

Parameters:
file Filename to open
access File access (r, w, a, r+, see fopen)

References WXP::String::get(), and open().

int File::open ( const char *  file,
const char *  raccess 
)
int File::printf ( const char *  fmt,
  ... 
)

Prints formatted data to file (see fprintf)

Parameters:
fmt Printf format to use
... Variables to format

Referenced by WXP::SfcWxpFile::open(), WXP::SfcUniFile::open(), open(), WXP::Message::print(), WXP::ImgWxpFile::write(), and WXP::MapFile::writeHeader().

int File::read ( unsigned char *  buf,
int  size 
)

Reads a set number of values from file (see fread)

Return values:
buf Output byte buffer
Parameters:
size Number of bytes
int File::read ( unsigned char *  buf,
int  size,
int  num 
)
int File::rewind (  ) 
int File::scanf ( const char *  fmt,
  ... 
)
int File::seek ( int  byte,
int  where 
)
int File::setShare ( int  mode  )  [static]

Sets the share mode for file

Parameters:
mode 1=shared, 0=not shared
int File::skipLine (  ) 
int File::tell (  ) 
int File::write ( const unsigned char *  buf,
int  size 
)

Writes a set number of values to file (see fwrite)

Parameters:
buf Input byte buffer
size Number of bytes
int File::write ( const unsigned char *  buf,
int  size,
int  num 
)

Writes a set number of values to file (see fwrite)

Parameters:
buf Input byte buffer
size Size of each value in bytes
num Number of values

Referenced by WXP::ImgWxpFile::write(), and WXP::GifFile::write().


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

Generated on 8 Jan 2010 for WXP C++ Library by  doxygen 1.6.1