-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmsg.cpp
More file actions
50 lines (43 loc) · 1002 Bytes
/
Copy pathmsg.cpp
File metadata and controls
50 lines (43 loc) · 1002 Bytes
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
#include "headers.h"
//сообщение
msg::msg(){
id_m = 1;
id_p = 1;
time = 1;
retweet_count = 0;
}
msg::~msg(){
}
msg::msg(const msg& ms){
id_m = ms.id_m;
id_p = ms.id_p;
time = ms.time;
retweet_count = ms.retweet_count;
}
msg& msg::operator =(const msg & ms){
id_m = ms.id_m;
id_p = ms.id_p;
time = ms.time;
retweet_count = ms.retweet_count;
return *this;
}
bool msg::read(FILE *fin){
int lol;
if ((fscanf(fin, "%d", &lol) != 1))
return false;
if ((fscanf(fin, "%llu", &id_m) != 1))
return false;
if ((fscanf(fin, "%llu", &id_p) != 1))
return false;
if ((fscanf(fin, "%d", &time) != 1))
return false;
if ((fscanf(fin, "%d", &retweet_count) != 1))
return false;
return true;
}
void msg::print(){
printf("%llu %llu %d %d\n", id_m, id_p, time, retweet_count);
}
void msg::fprint(FILE *fout){
fprintf(fout, "%llu %llu %d %d\n", id_m, id_p, time, retweet_count);
}