NO

Author Topic: fread() - slow on 4GB file  (Read 8889 times)

Offline Vortex

  • Member
  • *
  • Posts: 864
    • http://www.vortex.masmcode.com
Re: fread() - slow on 4GB file
« Reply #15 on: November 14, 2023, 10:48:16 AM »
Code it... That's all...

Offline Vortex

  • Member
  • *
  • Posts: 864
    • http://www.vortex.masmcode.com
Re: fread() - slow on 4GB file
« Reply #16 on: December 03, 2023, 11:42:06 AM »
The companion of ReadFileToMem to write file to disc :

Code: [Select]
// pFileName  : pointer fo file name
// pMemory    : pointer to the data to be written
// nSize      : number of bytes to be written

BOOL WriteFileToDisc (LPSTR pFileName,LPBYTE pMemory,DWORD nSize)
{
  HANDLE hFile;
  DWORD pWritten;
  BOOL t;

  hFile=CreateFile(pFileName,GENERIC_WRITE,0,0,CREATE_ALWAYS,0,0);

  if(hFile==INVALID_HANDLE_VALUE ){
      return 0;
    }

  t=WriteFile(hFile,pMemory,nSize, &pWritten,0);

  if(!t){
      return 0;
    }

  t=CloseHandle(hFile);

  if(!t){
      return 0;
    }
  return 1;
}
Code it... That's all...