Xavax C++ Library Class Index   FAQ   Overview

Class xavax::File

File encapsulates a POSIX file descriptor and provides methods to access system calls that operate on file descriptors.

Constructor Summary
File(const char* filename, const char* mode)
         Construct a File object.

Method Summary
void close()
         Close the file.
int read(char* buffer, int count)
         Read characters from a file.
int write(const char* buffer, int count)
         Write characters to a file.

Related Classes
 

Constructor Detail

File

File(const char* name, const char* mode)
Construct a File object. The mode is passed to the fopen system call when the file is opened.
Parameters:
name - the name of the file.
mode - the mode of the file.

Method Detail

close

void close()
Close the file.

read

int read(char* buffer, int count)
Read up to count characters from the file into buffer and return the number of characters read.
Parameters:
buffer - the buffer for the characters read.
count - the maximum number of characters to read.
Returns:
the number of characters read.

write

int write(const char* buffer, int count)
Write count characters from buffer to the file and return the number of characters written.
Parameters:
buffer - the array of characters to be written.
count - the number of characters to write.
Returns:
the number of characters written.

Example Code

Copyright © 2003 Xavax Inc. -- All Rights Reserved