b311480e |
1 | // Copyright (c) 1999-2012 OPEN CASCADE SAS |
2 | // |
3 | // The content of this file is subject to the Open CASCADE Technology Public |
4 | // License Version 6.5 (the "License"). You may not use the content of this file |
5 | // except in compliance with the License. Please obtain a copy of the License |
6 | // at http://www.opencascade.org and read it completely before using this file. |
7 | // |
8 | // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its |
9 | // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France. |
10 | // |
11 | // The Original Code and all software distributed under the License is |
12 | // distributed on an "AS IS" basis, without warranty of any kind, and the |
13 | // Initial Developer hereby disclaims all such warranties, including without |
14 | // limitation, any warranties of merchantability, fitness for a particular |
15 | // purpose or non-infringement. Please see the License for the specific terms |
16 | // and conditions governing the rights and limitations under the License. |
17 | |
7fd59977 |
18 | #include <stdio.h> |
19 | #include <sys/stat.h> |
20 | |
21 | #ifdef WNT |
22 | # include <io.h> |
23 | #endif /* WNT */ |
24 | |
25 | static FILE* filed; |
26 | /***************************************************OPEN_FILE**************/ |
27 | FILE* OPEN_FILE (char* f_name, int TypeCgm) |
28 | { |
29 | switch (TypeCgm){ |
30 | case 1: |
31 | case 2: |
32 | if ((filed = fopen(f_name,"wb" ))) { |
33 | #ifdef WNT |
34 | chmod (f_name, S_IREAD | S_IWRITE); |
35 | #else |
36 | chmod (f_name, 00777); |
37 | #endif |
38 | /* setbuf (filed, NULL);*/ |
39 | } |
40 | break; |
41 | case 3: |
42 | if ((filed = fopen(f_name,"w" ))) { |
43 | #ifdef WNT |
44 | chmod (f_name, S_IREAD | S_IWRITE); |
45 | #else |
46 | chmod (f_name, 00777); |
47 | #endif |
48 | /* setbuf (filed, NULL);*/ |
49 | } |
50 | break; |
51 | } |
52 | return filed; |
53 | } |
54 | |
55 | /**************************************************CLOSE_FILE************/ |
56 | void CLOSE_FILE () |
57 | { |
58 | fclose (filed); |
59 | } |
60 | |
61 | /**************************************************getfd************/ |
62 | FILE* getfd () |
63 | { |
64 | return filed; |
65 | } |