xref: /trunk/main/xml2cmp/source/inc/textfile.h (revision 514f4c20)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef CPV_TEXTFILE_H
25 #define CPV_TEXTFILE_H
26 
27 #include <stdio.h>
28 #include "str.h"
29 
30 
31 
32 typedef struct TextFile
33 {
34 	Cstring				sName;
35 	FILE *				hFile;
36     intt				nLastAction;
37 } TextFile;
38 
39 #define TextFile_THIS		TextFile * pThis
40 
41 
42 
43 void           		TextFile_CTOR( TextFile_THIS,
44 						char *				i_pName );
45 void           		TextFile_DTOR( TextFile_THIS );
46 
47 Bool			   	TF_Open( TextFile_THIS,
48 						char * 				i_sOptions );    /* options for second parameter of fopen */
49 Bool			   	TF_Create( TextFile_THIS );
50 void			   	TF_Close( TextFile_THIS );
51 
52 void			   	TF_Goto( TextFile_THIS,
53 						intt	 			i_nPosition );
54 intt			   	TF_Read( TextFile_THIS,
55 						char *				o_pBuffer,
56 						intt				i_nNrOfBytes );
57 intt			   	TF_Write( TextFile_THIS,
58 						char *				i_pBuffer,
59 						intt				i_nNrOfBytes );
60 intt			   	TF_WriteStr( TextFile_THIS,
61 						char *				i_pString );
62 
63 intt			   	TF_Position( TextFile_THIS );
64 intt			   	TF_Size( TextFile_THIS );
65 
66 
67 
68 
69 #endif
70 
71 
72 
73