os-70-350

os-70-350 Commit Details


Date:2015-01-25 18:37:22 (10 years 7 months ago)
Author:Natalie Adams
Branch:master
Commit:d4aff96eef8bdd909e18544279e7e4ade5ab8a28
Parents: 11888a7b7bd6d59738634fbfb2fefe1e4b263e41
Message:Fixing formatting

Changes:

File differences

cp/main.cpp
3838
3939
4040
41
42
43
44
45
46
41
42
43
44
45
46
4747
48
49
50
51
52
53
48
49
50
51
52
53
5454
55
56
57
58
59
60
61
62
63
64
55
56
57
58
59
60
61
62
63
64
6565
6666
6767
// Open the source
// A little RAII
{
FileWrapper src(args[1], GENERIC_READ, OPEN_EXISTING);
if (GetLastError() == ERROR_FILE_NOT_FOUND)
{
WriteStr("Could not find file!");
return 0;
}
FileWrapper src(args[1], GENERIC_READ, OPEN_EXISTING);
if (GetLastError() == ERROR_FILE_NOT_FOUND)
{
WriteStr("Could not find file!");
return 0;
}
// Open destination file
FileWrapper dst(args[2], GENERIC_WRITE, CREATE_ALWAYS);
DWORD numberofbytesread;
DWORD numberofbyteswritten;
char buffer[20];
// Open destination file
FileWrapper dst(args[2], GENERIC_WRITE, CREATE_ALWAYS);
DWORD numberofbytesread;
DWORD numberofbyteswritten;
char buffer[20];
// Stream the file instead of reading it into memory
while(true)
{
// The buffer parameter is a void pointer which means it can take anything - in this case we just use a char array
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa365467(v=vs.85).aspx
ReadFile(src.getHandle(), buffer, 20, &numberofbytesread, NULL); // http://stackoverflow.com/questions/12655120/readfile-function-from-win32-api
if (numberofbytesread == 0)
break;
WriteFile(dst.getHandle(), buffer, numberofbytesread, &numberofbyteswritten, NULL);
}
// Stream the file instead of reading it into memory
while(true)
{
// The buffer parameter is a void pointer which means it can take anything - in this case we just use a char array
// http://msdn.microsoft.com/en-us/library/windows/desktop/aa365467(v=vs.85).aspx
ReadFile(src.getHandle(), buffer, 20, &numberofbytesread, NULL); // http://stackoverflow.com/questions/12655120/readfile-function-from-win32-api
if (numberofbytesread == 0)
break;
WriteFile(dst.getHandle(), buffer, numberofbytesread, &numberofbyteswritten, NULL);
}
}
std::vector<wchar_t> wstr;

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.11678s using 14 queries.