Main Page   Class Hierarchy   Compound List   File List   Compound Members   Examples  

AxisFile.h

00001 /*
00002  *   Copyright 2003-2004 The Apache Software Foundation.
00003  *
00004  *   Licensed under the Apache License, Version 2.0 (the "License");
00005  *   you may not use this file except in compliance with the License.
00006  *   You may obtain a copy of the License at
00007  *
00008  *       http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  *   Unless required by applicable law or agreed to in writing, software
00011  *   distributed under the License is distributed on an "AS IS" BASIS,
00012  *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  *   See the License for the specific language governing permissions and
00014  *   limitations under the License.
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 

Generated on Tue Jun 15 19:13:22 2004 for axiscpp by doxygen1.2.18