text: I'm trying to make a small application that will read in a file, split it up and output each part to a different file. I'm trying to do this using Windows specific file I/O, and basically i'm completely lost. This is what i have so far:
  In explorer the file "soeasy.mp3" is 3,66 MB. But the output i am getting is 3841925, is there something wrong with the code? And why doesn't the sizes match up?In explorer the file "soeasy.mp3" is 3,66 MB. But the output i am getting is 3841925, is there something wrong with the code? And why doesn't the sizes match up?Code:
  #include <windows.h>
  #include <iostream>
  int main(int argc, char* argv[])
  {
  const CHAR *file = "soeasy.mp3"; //This is hardcoded for now, ill change that when the rest works.
  HANDLE hfile = CreateFile(file,
  GENERIC_READ,
  0,
  NULL,
  OPEN_EXISTING,
  FILE_ATTRIBUTE_NORMAL,
  NULL);
  unsigned long file_length = GetFileSize(hfile, NULL);
  std::cout << file_length << std::endl;
  return 0;
  }
  After i've gotten the file size, i've got to allocate enough memory to read the filesize divided by the number of output files into memory, i'm guessing i have to use ReadFile() for this? Is there a difference between binary I/O and text file I/O with theese functions, like with fstream?
  When should i call GetLastError()? After each of the function calls or? Anything else that i am forgetting?