Pelles C > Bug reports

fread() - slow on 4GB file

<< < (4/4)

Vortex:
Hello,

Thanks for the setvbuf tip :

https://www.tutorialspoint.com/c_standard_library/c_function_setvbuf.htm

Vortex:
The companion of ReadFileToMem to write file to disc :


--- Code: ---// 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;
}
--- End code ---

Navigation

[0] Message Index

[*] Previous page

Go to full version