ulib  1.0
S.W. Lee's essential C++ library
 All Classes Namespaces Files Functions Variables Typedefs Macros Pages
ufile.h
Go to the documentation of this file.
1 /*
2  작성자 : 이승욱
3  작성일 : 08.05.12
4  버전 : 0.1.0
5  설명 : 파일 처리 라이브러리
6  미구현 : ???
7  버그 : ???
8 */
9 
10 #ifndef ___ufile___
11 #define ___ufile___
12 
13 #include <stdio.h>
14 #include <string.h>
15 #include "ustring.h"
16 
17 #ifndef UNKNOWN
18 #define UNKNOWN -1
19 #endif
20 #ifndef UFILE_BUFF_SIZE
21 #define UFILE_BUFF_SIZE 1024 // fgets로 읽을 버퍼의 크기( 최소 2 이상 )
22 #endif
23 
24 namespace ulib {
25 
26  class CUFile {
27  public:
28  // 생성자 소멸자
29  CUFile( int verbosity = 0 );
30  CUFile( CUString arg_file_name, CUString arg_file_mode = "rb", int verbosity = 0 );
31  ~CUFile();
32 
33 
34  public:
35  void Verbosity( int arg_verbosity );
36  bool IsOpen();
37  bool OpenFile( CUString arg_file_name, CUString arg_file_mode = "r" );
38  void CloseFile();
39  bool ReopenFile( CUString arg_file_name, CUString arg_file_mode = "r" );
40  FILE *GetFP();
41  void MoveToStart();
42  void MoveToEnd();
43  long GetFileSize();
44  static long GetFileSize( CUString filename );
45  static long GetFileSize( char filename[] );
48 
49  public:
50 
51  private:
52  CUString file_name; // 파일명
53  CUString file_mode; // 파일모드
54  FILE *fp; // 파일포인터
55  long file_size; // 파일 크기
56  int verbosity; // 메시지를 화면에 출력할 정도
57 
58  private:
59  // 초기화
60  void Init();
61 
62  };
63 
64 }
65 #endif
66