Today, when we split large files, we found a strange phenomenon:
1. Use a 5 K file to test the splitting to a file with a maximum size of 1 K.
2. When a 2.2g file is used for testing and split into a file with a maximum of 2 GB, seven 2 GB files and a small file are generated.
After one-step debugging, it is found that the size of the original 2.gb file is larger than 17 GB.
The function for getting the file size from the original error is:
Code:
- Ulonglong getfilesize (lpctstr szfilename)
- {
- Cfilestatus FS;
- If (! Cfile: getstatus (szfilename, FS) return 0;
- Return fs. m_size;
- }
And then modify it:
Code:
- Ulonglong getfilesize (lpctstr szfilename)
- {
- CFileFind finder; // File Search Class
- If (! Finder. FindFile (szFileName) return 0;
- Finder. FindNextFile ();
- ULONGLONG ul = finder. GetLength ();
- Finder. Close ();
- Return ul;
- }
After modification, the split function is normal.