Current location - Loan Platform Complete Network - Big data management - Daxia big data
Daxia big data
C language maximum file length acquisition function overflows when it reaches 4GB.

Use windows api to get the file length. GetFileSize is divided into high state and return from return value and parameter respectively.

When writing, you can set the offset value through the lpOverlapped parameter of WriteFile, which can support larger files.

Although there are many parameters, it can always solve your problem. If there are many places to call, you can encapsulate these functions, and many parameters are called the same. I hope it helps you.

DWORD WINAPI GetFileSize(

_ _ When dealing with hFile,

__out_opt LPDWORD lpFileSizeHigh

);

BOOL WINAPI WriteFile(

_ _ When dealing with hFile,

_ _ in LPCVOID lpBuffer,

_ _ In DWORD nNumberOfBytesToWrite,

_ _ out _ opt lpd word lpnumberofbytes written,

_ _ inout _ opt LP overlapped LP overlapped

);

Processing WINAPI creation files (

__in LPCTSTR lpFileName,

_ _ in DWORD dwDesiredAccess,

_ _ in DWORD dwShareMode,

_ _ in _ opt LP security _ ATTRIBUTES lpSecurityAttributes,

_ _ in DWORD dwCreationDisposition,

__in DWORD dwFlagsAndAttributes,

__in_opt processing hTemplateFile

);

ask

Minimum supported client Windows XP

Minimum supported server Windows Server 2003

HeaderFileAPI.h (including windows.h); WinBase.h on Windows Server 2008 R2, Windows 7, Windows Server 2008, Windows Vista, Windows Server 2003 and Windows XP (including Windows.h).

LibraryKernel32.lib

DLLKernel32.dll

Unicode and ANSI names CreateFileW (Unicode) and CreateFileA (ANSI).