blob: dcf6e80c25557acaef13c861edbb817c15a24318 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#include <stdio.h>
#include <sys/stat.h>
#ifdef WNT
# include <io.h>
#endif /* WNT */
static FILE* filed;
/***************************************************OPEN_FILE**************/
FILE* OPEN_FILE (char* f_name, int TypeCgm)
{
switch (TypeCgm){
case 1:
case 2:
if ((filed = fopen(f_name,"wb" )) != NULL) {
#ifdef WNT
chmod (f_name, S_IREAD | S_IWRITE);
#else
chmod (f_name, 00777);
#endif
/* setbuf (filed, NULL);*/
}
break;
case 3:
if ((filed = fopen(f_name,"w" )) != NULL) {
#ifdef WNT
chmod (f_name, S_IREAD | S_IWRITE);
#else
chmod (f_name, 00777);
#endif
/* setbuf (filed, NULL);*/
}
break;
}
return filed;
}
/**************************************************CLOSE_FILE************/
void CLOSE_FILE ()
{
fclose (filed);
}
/**************************************************getfd************/
FILE* getfd ()
{
return filed;
}
|