IncrementalReadInterface.cpp 832 B

12345678910111213141516171819202122232425
  1. /*
  2. * Copyright (c) 2014, Oculus VR, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree. An additional grant
  7. * of patent rights can be found in the PATENTS file in the same directory.
  8. *
  9. */
  10. #include "IncrementalReadInterface.h"
  11. #include <stdio.h>
  12. using namespace RakNet;
  13. unsigned int IncrementalReadInterface::GetFilePart( const char *filename, unsigned int startReadBytes, unsigned int numBytesToRead, void *preallocatedDestination, FileListNodeContext context)
  14. {
  15. FILE *fp = fopen(filename, "rb");
  16. if (fp==0)
  17. return 0;
  18. fseek(fp,startReadBytes,SEEK_SET);
  19. unsigned int numRead = (unsigned int) fread(preallocatedDestination,1,numBytesToRead, fp);
  20. fclose(fp);
  21. return numRead;
  22. }
粤ICP备19079148号