00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #if !defined(__AXIS_AXISFILE_H_OF_AXIS_INCLUDED__)
00018 #define __AXIS_AXISFILE_H_OF_AXIS_INCLUDED__
00019 #include <axis/server/GDefine.h>
00020 #include <stdio.h>
00021 #include <string.h>
00022
00039 class AxisFile
00040 {
00041 public:
00045 AxisFile()
00046 {
00047 pFILEFile = NULL;
00048 }
00049
00054 AxisFile(FILE* pFILEParamFile)
00055 {
00056 pFILEFile = pFILEParamFile;
00057 }
00058
00064 int fileOpen(const char* sFileName, const char* sFilePerm)
00065 {
00066 if ((pFILEFile = fopen (sFileName, sFilePerm)) == NULL)
00067 return AXIS_FAIL;
00068 return AXIS_SUCCESS;
00069 }
00070
00076 int fileGet(char* sLine, int iBufferSize)
00077 {
00078 if(fgets (sLine, iBufferSize, pFILEFile) != NULL )
00079 {
00080 char * newline = strpbrk(sLine, "\n");
00081 if(newline)
00082 {
00083 *newline = '\0';
00084 }
00085 return AXIS_SUCCESS;
00086 }
00087
00088 return AXIS_FAIL;
00089 }
00090
00094 int filePuts (const char* pcWrite)
00095 {
00096 if (-1 < fputs(pcWrite, pFILEFile))
00097 return AXIS_SUCCESS;
00098 return AXIS_FAIL;
00099 }
00100
00103 int fileFlush ()
00104 {
00105 if (0 == fflush(pFILEFile))
00106 return AXIS_SUCCESS;
00107 return AXIS_FAIL;
00108 }
00109
00110 ~AxisFile()
00111 {
00112 if(pFILEFile)
00113 fclose(pFILEFile);
00114 }
00115
00116 private:
00117 FILE* pFILEFile;
00118 };
00119 #endif
00120