home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 2003 November / VPR0311.ISO / OLS / TAR32223 / tar32223.lzh / tar32_2 / src / normal.h < prev    next >
C/C++ Source or Header  |  2003-01-17  |  2KB  |  64 lines

  1. /*
  2.     normal.h
  3.         normal file input/output class.
  4.         by Yoshioka Tsuneo(QWF00133@nifty.ne.jp)
  5. */
  6. /*    
  7.     このファイルの利用条件:
  8.         このソースファイルの利用制限は一切ありません。
  9.         ソースの一部、全部を商用、非商用など目的に
  10.         かかわりなく他のプログラムで自由に使用できます。
  11.         パブリック・ドメイン・ソフトウェアと同様に扱えます。
  12.     
  13.     プログラマ向けの要望(制限ではありません):
  14.         ソース中に改善すべき点があればお知らせください。
  15.         ソースコード中にバグを見つけた場合は報告してください。
  16.         直した部分などありましたら教えてください。
  17.         断片的な情報でも結構です。
  18.         このファイルを利用した場合はなるべく教えてください。
  19. */
  20. /*
  21.     LICENSE of this file:
  22.         There is no restriction for using this file.
  23.         You can use this file in your software for any purpose.
  24.         In other words, you can use this file as Public Domain Software.
  25.  
  26.     RECOMMENDATION for Programmer(not restriction):
  27.         If you find points to improve code, please report me.
  28.         If you find bug in source code, please report me.
  29.         If you fixed bug, please teach me.
  30.         I want any trivial information.
  31.         If you use this file, please report me.
  32. */
  33. #include "arcfile.h"
  34. #include <stdio.h>
  35. #include "tar32api.h" // ARCHIVETYPE_
  36.  
  37. class CTarArcFile_Normal : public ITarArcFile{
  38. public:
  39.     CTarArcFile_Normal::~CTarArcFile_Normal(){
  40.         close();
  41.     };
  42.     bool open(const char *arcfile, const char *mode){
  43.         m_arcfile = arcfile;
  44.         m_fp = fopen(arcfile,mode);
  45.         return (bool)(m_fp!=NULL);
  46.     };
  47.     int read(void *buf, int size){
  48.         return fread(buf,1,size,m_fp);
  49.     };
  50.     int write(void *buf, int size){
  51.         return fwrite(buf,1,size,m_fp);
  52.     };
  53.     int seek(int offset, int origin){
  54.         return fseek(m_fp, offset,origin);
  55.     }
  56.     void close(){
  57.         if(m_fp){
  58.             fclose(m_fp);m_fp=NULL;
  59.         }
  60.     }
  61.     int get_archive_type(){return ARCHIVETYPE_NORMAL;}
  62. private:
  63.     FILE *m_fp;
  64. };