Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members   Examples  

AxisFile.h

Go to the documentation of this file.
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 
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 

Generated on Tue Jun 29 09:27:55 2004 for AxisC++ by doxygen1.2.18