////////////////
// File class //
////////////////

#ifndef __PTC_FILE_H
#define __PTC_FILE_H

#include "list.h"
#include <stdio.h>



                   
                  

           
class File
{
    public:

        // setup
        File();
        File(char *filename,char *mode=NULL);
        ~File();

        // open and close
        int open(char *filename,char *mode=NULL);
        int reopen();
        void close();

        // file operations
        int seek(long offset,int origin=SEEK_CUR);
        int read(void *buffer,unsigned bytes);
        int write(void *buffer,unsigned bytes);
        int puts(char *string);
        int eof();
        int size();

        // data access
        FILE* GetHandle();
        int GetFilename(char filename[]);
        int GetFilemode(char filemode[]);

        // status
        int ok() const;

    protected:

        // defaults
        void Defaults();

        // file handle
        FILE *Handle;

        // file information
        char Filename[4096]; 
        char Filemode[256];
};










#endif
