Kan iemand dit verklaren?
(VC9 x64)
seekpos() is zeker geen standaard C++ heh?
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
| #include <iostream> #include <fstream> int main() { std::cout << "size_t " << sizeof(size_t)*8 << " bits" << std::endl; std::cout << "long long " << sizeof(long long)*8 << " bits" << std::endl; std::cout << "int: " << sizeof(int)*8 << " bits" << std::endl; std::cout << "void*: " << sizeof(void*)*8 << " bits" << std::endl; std::cout << "std::streamoff: " << sizeof(std::streamoff)*8 << " bits" << std::endl; std::cout << "std::fpos_t: " << sizeof(std::fpos_t)*8 << " bits" << std::endl; std::ifstream ifs("C:\\Users\\Ferdi\\Desktop\\3Dheart_021_20100107\\section021.RAW", std::ios::in | std::ios::binary); if (ifs.is_open()) { ifs.seekg(0, std::ios::end); long long end1 = ifs.tellg(); // fails long long end2 = ifs.tellg().seekpos(); // works std::cout << "Should be : 4255514008 bytes" << std::endl; std::cout << "File size 1: " << end1 << " bytes" << std::endl; std::cout << "File size 2: " << end2 << " bytes" << std::endl; } return 0; } Out: size_t 64 bits long long 64 bits int: 32 bits void*: 64 bits std::streamoff: 64 bits std::fpos_t: 64 bits Should be : 4255514008 bytes File size 1: -39453288 bytes File size 2: 4255514008 bytes |
(VC9 x64)
seekpos() is zeker geen standaard C++ heh?