,   CyberForum.ru

++


 
sweetydady
6 / 2 / 1
: 19.02.2012
: 40
#1

GetFileSizeEx - cout, - C++

26.04.2012, 19:30. 433. 0
( )

C++ (Qt)
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
#include <windows.h>
#include <iostream>
#include<cstdlib>
using namespace std;
 
int main()
{
  HANDLE  hFile;
  LARGE_INTEGER  liFileSize;  // ð*çìåð ô*éë*
  
  
 
  // îòêðûâ*åì ô*éë äëÿ ÷òå*èÿ
  hFile = CreateFile(
    "C:\\demo_file.dat",   // èìÿ ô*éë*
    GENERIC_READ,          // ÷òå*èå èç ô*éë*
    0,                     // ìî*îïîëü*ûé äîñòóï ê ô*éëó
    NULL,                  // ç*ùèòû *åò 
    OPEN_EXISTING,         // îòêðûâ*åì ñóùåñòâóþùèé ô*éë
    FILE_ATTRIBUTE_NORMAL, // îáû÷*ûé ô*éë
    NULL                   // ø*áëî** *åò
  );
  // ïðîâåðÿåì ** óñïåø*îå îòêðûòèå
  if (hFile == INVALID_HANDLE_VALUE)
 
  {
    cerr << "Create file failed." << endl
      << "The last error code: " << GetLastError() << endl;
    cout << "Press any key to finish.";
    cin.get();
 
    return 0;
  }
  
  // îïðåäåëÿåì ð*çìåð ô*éë*
  BOOL GetFileSizeEx(
  HANDLE hFile,              // äåñêðèïòîð ô*éë*
  PLARGE_INTEGER lpFileSize  // ð*çìåð ô*éë*
);
  if (!GetFileSizeEx(hFile, &liFileSize))
    cerr << "Get file size failed." << endl
      << "The last error code: " << GetLastError() << endl;
    CloseHandle(hFile);
    cout << "Press any key to finish.";
    cin.get();
 
    return 0;
  }
  // âûâîäèì ð*çìåð ô*éë*
  cout << "File size: " << liFileSize.LowPart << endl;
  // ç*êðûâ*åì äåñêðèïòîð ô*éë* 
  CloseHandle(hFile);
 
  return 0;
}
Similar
41792 / 34177 / 6122
: 12.04.2006
: 57,940
26.04.2012, 19:30     GetFileSizeEx - cout,
:
C++
C++ cout<<<
C++ , ( c++)
C++ cout cin
C++ cout
C++ ( cout)
cin cout C++
C++ C2065 : cout
C++ coutnum[t][i]; ?
cout.setf cout.precision C++
/ - "Cout undeclared" C++
cout vs. std::cout C++



:
.

- , ,
-
Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
@Mail.ru