00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00024 #if !defined(__AXIS_AXISFILE_H_OF_AXIS_INCLUDED__)
00025 #define __AXIS_AXISFILE_H_OF_AXIS_INCLUDED__
00026 #include <axis/server/GDefine.h>
00027 #include <stdio.h>
00028 #include <string.h>
00029
00046 class AxisFile
00047 {
00048 public:
00052 AxisFile()
00053 {
00054 pFILEFile = NULL;
00055 }
00056
00061 AxisFile(FILE* pFILEParamFile)
00062 {
00063 pFILEFile = pFILEParamFile;
00064 }
00065
00071 int fileOpen(const char* sFileName, const char* sFilePerm)
00072 {
00073 if ((pFILEFile = fopen (sFileName, sFilePerm)) == NULL)
00074 return AXIS_FAIL;
00075 return AXIS_SUCCESS;
00076 }
00077
00083 int fileGet(char* sLine, int iBufferSize)
00084 {
00085 if(fgets (sLine, iBufferSize, pFILEFile) != NULL )
00086 {
00087 char * newline = strpbrk(sLine, "\n");
00088 if(newline)
00089 {
00090 *newline = '\0';
00091 }
00092 return AXIS_SUCCESS;
00093 }
00094
00095 return AXIS_FAIL;
00096 }
00097
00101 int filePuts (const char* pcWrite)
00102 {
00103 if (-1 < fputs(pcWrite, pFILEFile))
00104 return AXIS_SUCCESS;
00105 return AXIS_FAIL;
00106 }
00107
00110 int fileFlush ()
00111 {
00112 if (0 == fflush(pFILEFile))
00113 return AXIS_SUCCESS;
00114 return AXIS_FAIL;
00115 }
00116
00117 ~AxisFile()
00118 {
00119 if(pFILEFile)
00120 fclose(pFILEFile);
00121 }
00122
00123 private:
00124 FILE* pFILEFile;
00125 };
00126 #endif
00127