prog.cpp: In function ‘int main(int, char**)’:
prog.cpp:4:3: error: ‘::fprintf’ has not been declared
::fprintf(stderr, "Usage: %s <filepath> <buffer size>\n", argv[0]);
^~
prog.cpp:4:13: error: ‘stderr’ was not declared in this scope
::fprintf(stderr, "Usage: %s <filepath> <buffer size>\n", argv[0]);
^~~~~~
prog.cpp:9:2: error: ‘size_t’ was not declared in this scope
size_t buf_size = ::strtoul(argv[2], NULL, 10);;
^~~~~~
prog.cpp:11:6: error: ‘buf_size’ was not declared in this scope
if (buf_size == 0) {
^~~~~~~~
prog.cpp:12:3: error: ‘::fprintf’ has not been declared
::fprintf(stderr, "Usage: %s <filepath> <buffer size>\n", filename);
^~
prog.cpp:12:13: error: ‘stderr’ was not declared in this scope
::fprintf(stderr, "Usage: %s <filepath> <buffer size>\n", filename);
^~~~~~
prog.cpp:13:3: error: ‘::fprintf’ has not been declared
::fprintf(stderr, "<buffer size> must be greater than zero\n", filename);
^~
prog.cpp:17:2: error: ‘DWORD’ was not declared in this scope
DWORD uBytesPerSector;
^~~~~
prog.cpp:18:8: error: expected ‘;’ before ‘uSectorsPerCluster’
DWORD uSectorsPerCluster;
^~~~~~~~~~~~~~~~~~
prog.cpp:20:2: error: ‘::GetDiskFreeSpace’ has not been declared
::GetDiskFreeSpace(NULL, &uSectorsPerCluster, &uBytesPerSector, NULL, NULL);
^~
prog.cpp:20:21: error: ‘NULL’ was not declared in this scope
::GetDiskFreeSpace(NULL, &uSectorsPerCluster, &uBytesPerSector, NULL, NULL);
^~~~
prog.cpp:20:28: error: ‘uSectorsPerCluster’ was not declared in this scope
::GetDiskFreeSpace(NULL, &uSectorsPerCluster, &uBytesPerSector, NULL, NULL);
^~~~~~~~~~~~~~~~~~
prog.cpp:20:49: error: ‘uBytesPerSector’ was not declared in this scope
::GetDiskFreeSpace(NULL, &uSectorsPerCluster, &uBytesPerSector, NULL, NULL);
^~~~~~~~~~~~~~~
prog.cpp:21:2: error: ‘::fprintf’ has not been declared
::fprintf(stderr, "info: byte per cluster %u\n", uBytesPerSector);
^~
prog.cpp:21:12: error: ‘stderr’ was not declared in this scope
::fprintf(stderr, "info: byte per cluster %u\n", uBytesPerSector);
^~~~~~
prog.cpp:22:2: error: ‘::fprintf’ has not been declared
::fprintf(stderr, "info: secter per cluster %u\n", uSectorsPerCluster);
^~
prog.cpp:24:2: error: ‘time_t’ was not declared in this scope
time_t u_start = time(NULL);
^~~~~~
prog.cpp:26:2: error: ‘HANDLE’ was not declared in this scope
HANDLE hFile;
^~~~~~
prog.cpp:27:8: error: expected ‘;’ before ‘uNumberOfBytesRead’
DWORD uNumberOfBytesRead;
^~~~~~~~~~~~~~~~~~
prog.cpp:30:2: error: ‘hFile’ was not declared in this scope
hFile = ::CreateFile(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_NO_BUFFERING, NULL);
^~~~~
prog.cpp:30:10: error: ‘::CreateFile’ has not been declared
hFile = ::CreateFile(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_NO_BUFFERING, NULL);
^~
prog.cpp:30:33: error: ‘GENERIC_READ’ was not declared in this scope
hFile = ::CreateFile(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_NO_BUFFERING, NULL);
^~~~~~~~~~~~
prog.cpp:30:56: error: ‘OPEN_EXISTING’ was not declared in this scope
hFile = ::CreateFile(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_NO_BUFFERING, NULL);
^~~~~~~~~~~~~
prog.cpp:30:71: error: ‘FILE_ATTRIBUTE_NORMAL’ was not declared in this scope
hFile = ::CreateFile(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_NO_BUFFERING, NULL);
^~~~~~~~~~~~~~~~~~~~~
prog.cpp:30:93: error: ‘FILE_FLAG_NO_BUFFERING’ was not declared in this scope
hFile = ::CreateFile(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL|FILE_FLAG_NO_BUFFERING, NULL);
^~~~~~~~~~~~~~~~~~~~~~
prog.cpp:31:15: error: ‘INVALID_HANDLE_VALUE’ was not declared in this scope
if (hFile == INVALID_HANDLE_VALUE) {
^~~~~~~~~~~~~~~~~~~~
prog.cpp:32:3: error: ‘::fprintf’ has not been declared
::fprintf(stderr, "fatal error: open file error \"%s\"\n", filename);
^~
prog.cpp:36:10: error: ‘::malloc’ has not been declared
p_buf = ::malloc(buf_size);
^~
prog.cpp:36:19: error: ‘buf_size’ was not declared in this scope
p_buf = ::malloc(buf_size);
^~~~~~~~
prog.cpp:39:8: error: ‘::ReadFile’ has not been declared
if (!::ReadFile(hFile, p_buf, buf_size, &uNumberOfBytesRead, NULL)) {
^~
prog.cpp:39:44: error: ‘uNumberOfBytesRead’ was not declared in this scope
if (!::ReadFile(hFile, p_buf, buf_size, &uNumberOfBytesRead, NULL)) {
^~~~~~~~~~~~~~~~~~
prog.cpp:40:4: error: ‘::fprintf’ has not been declared
::fprintf(stderr, "fatal error: %u bytes read error\n", buf_size);
^~
prog.cpp:43:11: error: ‘uNumberOfBytesRead’ was not declared in this scope
} while (uNumberOfBytesRead == buf_size);
^~~~~~~~~~~~~~~~~~
prog.cpp:45:2: error: ‘::free’ has not been declared
::free(p_buf);
^~
prog.cpp:46:2: error: ‘::fprintf’ has not been declared
::fprintf(stdout, "%d\n", time(NULL) - u_start);
^~
prog.cpp:46:12: error: ‘stdout’ was not declared in this scope
::fprintf(stdout, "%d\n", time(NULL) - u_start);
^~~~~~
prog.cpp:46:37: error: ‘time’ was not declared in this scope
::fprintf(stdout, "%d\n", time(NULL) - u_start);
^
prog.cpp:46:41: error: ‘u_start’ was not declared in this scope
::fprintf(stdout, "%d\n", time(NULL) - u_start);
^~~~~~~