00001 #ifndef _WINC_FILE
00002 #define _WINC_FILE
00003
00004 #include <stdio.h>
00005
00006 #include <WXP/Buffer.h>
00007 #include <WXP/FileAttr.h>
00008 #include <WXP/String.h>
00009
00010 namespace WXP {
00011 class File : public FileAttr {
00012 int type;
00013 int stype;
00014 FILE *fp;
00015 int fd;
00016 void *ptr;
00017 bool opened;
00018 int access;
00019 static int shared;
00020
00021 public:
00022 int init( );
00023 File( const char *file, const char *raccess );
00024 File( String &file, const char *raccess );
00025 File( const char *file, int raccess );
00026 File();
00027 ~File();
00028 int open( const char *file, const char *raccess );
00029 int open( String &file, const char *raccess );
00030 int open( const char *file, int raccess );
00031 int getLine( char *string, int len );
00032 int getLine( String &string );
00033 int skipLine();
00034 bool isOpen();
00035 int rewind();
00036 int close();
00037 bool endFile();
00038 int scanf( const char *fmt, ... );
00039 int printf( const char *fmt, ... );
00040 int read( unsigned char *buf, int size, int num );
00041 int read( unsigned char *buf, int size );
00042 int read( Buffer &buf, int size );
00043 int read( Buffer &buf );
00044 int write( const unsigned char *buf, int size, int num );
00045 int write( const unsigned char *buf, int size );
00046 int tell();
00047 int seek( int byte, int where );
00048 inline int seek( int byte ){ return seek( byte, 0 ); };
00049 FILE *getFP();
00050
00051 enum Type {
00052 REG,
00053 PIPE,
00054 STDIO,
00055 FIFO,
00056 DEVICE,
00057 SOCKETC,
00058 SOCKETS,
00059 HTTP,
00060 FTP };
00061
00062 static const int FILE_LENGTH = 100;
00063
00064
00065
00066 enum Format {
00067 UNK,
00068 WXP,
00069 NETCDF,
00070 GRIB,
00071 BUFR,
00072 UNISYS,
00073 NONE };
00074
00075 static int setShare( int mode );
00076 };
00077 }
00078 #endif