@Mindz
7 / 7 / 1
Регистрация: 31.01.2010
Сообщений: 51
|
12.07.2012, 20:09
[ТС]
|
|
C++ | 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
| #include <cstdlib>
#include <iostream>
#include <fstream>
#include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
#include <windows.h>
void setRevision();
void setDate( const char* );
void getFile( const char* );
int Revision = 0, Date = 0;
using namespace std;
int main( int argc, char *argv[] )
{
system("COLOR E");
system("TITLE Revision Maker v 1.0.0");
char Path[100], exit, change;
cout << "\2" << endl;
do {
cout << "\nInput your file name (file.dat):";
cin >> Path;
fstream File( Path );
if( !File.is_open() ) {
cout << "Wrong Path to directory file!" << endl;
break;
}
while(ВОТ сюда надо впихнуть условие при котором проверяется открыт ли сейчас файл пользователем ) {
setDate( Path );
getFile( Path );
}
cout << "Revision: " << Revision << endl
<< "FileName:" << Path << endl;
<< "\nTo finish a program runtime?(Y\N):" << endl;
cin >> exit;
} while( exit != "Y" || exit != "y" );
cout << "bye, i see you later dev :)";
system("PAUSE");
return EXIT_SUCCESS;
}
void setDate( const char* file )
{
struct _stat st;
_stat( file, &st );
Date = st.st_mtime;
}
void setRevision()
{
Revision++;
}
void getFile( const char* name )
{
int buff_revision, buff_date;
fstream Revision_File( "Revision.ini" );
if( !Revision_File.is_open() ) {
ofstream New_File( "Revision.ini" );
New_File << "[Information]" << endl
<< "Revision=" << Revision << endl
<< "Date=" << Date << endl
<< "File=" << name << endl;
} else {
buff_revision = GetPrivateProfileInt(
"Information",
"Revision",
0,
"C:\\Dev-Cpp\\Projects\\RevisionMaker\\Revision.ini"
);
buff_date = GetPrivateProfileInt(
"Information",
"Date",
0,
"C:\\Dev-Cpp\\Projects\\RevisionMaker\\Revision.ini"
);
Revision = buff_revision;
if( buff_date < Date ) {
setRevision();
Revision_File << "[Information]" << endl
<< "Revision=" << Revision << endl
<< "Date=" << Date << endl
<< "File=" << name << endl;
}
}
Revision_File.close();
} |
|
Добавлено через 7 минут
Файл то меняется но вот вопрос как?Скорее всего данная функция не поможет.
0
|