forked from foshougua/network-dash
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFile.cpp
More file actions
38 lines (36 loc) · 958 Bytes
/
File.cpp
File metadata and controls
38 lines (36 loc) · 958 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
/*************************************************************************
> File Name: File.cpp
> Author:
> Mail:
> Created Time: 2017年05月10日 星期三 18时51分36秒
************************************************************************/
#include"File.h"
#include<iostream>
#include<string>
#include<fstream>
#include<cmath>
File::File(const std::string &fileName)
{
this->file.open(fileName, std::ios::binary);
if(this->file.is_open())
{
std::cout << "File get!" << std::endl;
}
else
{
std::cout << "File unget!" << std::endl;
}
this->file.seekg(0, std::ios::end);
fileSize = file.tellg();
std::cout << "File Size : " << fileSize << std::endl;
blockNum = ceil(static_cast<double>(fileSize) / (1024 * 1024 * 4));
std::cout << "Block Count: " << blockNum <<std::endl;
}
void File::Close()
{
(this->file).close();
}
int File::getBlockNum()
{
return this->blockNum;
}