Oops.
Did not mean to keep this question,
but if someone wants to answer,
nicely,
then that is OK.
I have two ways that I am looking at the file length. Which is better?
Use:
If I want to update some software for my uncle's old saw mill machine that has a programmable controller with C, and I want to code it in C or C++98 or in C++03, nothing newer:
I am doing a test on an old Windows XP Pro 32 bit system with every (at the time of installation) code page installed, and with CodeBlocks 17.12 and GCC of 5.1 .
Explaination for some people:
A DWORD is a 32-bit unsigned integer (range: 0 through 4294967295 decimal).
Using two of them together is one way of representing a 64-bit value.
In the event the value being represented fits into 32 bits just fine, the high-order DWORD will then be zero.
If the value is larger than fits into 32 bits then the low-order DWORD will be the remaining.
References and origins for some of my wording for some people:
See: https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-dtyp/262627d8-3418-4627-9218-4ffe110850b2
See: https://stackoverflow.com/questions/2995251/why-in-c-do-we-use-dword-rather-than-unsigned-int
See: https://forums.codeguru.com/showthread.php?465171-high-or-low-order-DWORD (very nice explaination of high vs low order).
I am using GetFileSize instead of GetFileSizeEx because my setup has difficulties with GetFileSizeEx. I know that Microsoft says, "It is recommended that you use GetFileSizeEx." But, it does not work well for this setup.
Here are the two ways. Please tell me which is best, or fastest, or more stable, and please explain why you personally think that.
One way I use a PDWORD. The other way I use a &DWORD.
Better? Faster? More stable? Specifically, why do you personally think that?
Thank you.
What I have tried:
const wchar_t* TheFile_to_READ;
TheFile_to_READ = L"utf8_UsingByteOrderMark_C_天堂.txt";
HANDLE HANDLE_Of_File_to_READ;
HANDLE_Of_File_to_READ = CreateFile(TheFile_to_READ, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
DWORD DW_001;
const unsigned long long DW_fileLength_001 = GetFileSize ( HANDLE_Of_File_to_READ, &DW_001 ) ;
long unsigned int DW_LUI_001 = DW_001;
string ppppBLA = to_string(DW_LUI_001);
PDWORD PDW_002;
const unsigned long long PDW_fileLength_002 = GetFileSize ( HANDLE_Of_File_to_READ, PDW_002 ) ;
long unsigned int LUI_002 = (DWORD)PDW_002;
string pppp = to_string(LUI_002);