   fread for memory?
  Hi all!My package-system depends on the fread functionality, and everything works fine, but now I have the problem that I have a package which is in memory. I don't want to write it down to the HDD (Or is that fast enought?) just to load it again. So, is there something fread-like? Read 4 bytes, into a variable, read 6 bytes into another, etc...   
  From what you described, memcpy should do the job...   ;  Yeah, I thougt about memcpy, too. But what when I have somethink like this:Package file:---------------------Some header (Int)EngineVersion (Int)Size of first data (UINT)first data (byte[50])Size of second data (UINT)second data (byte[25])---------------------So what if I need the second file? Lets say, we know the offset in bytes.Could I do this: UINT DataSize2=0;memcpy(&DataSize2,PackageData[FileOffset],sizeof(UINT));byte* Data=new byte[DataSize];memcpy(Data,PackageData[FileOffset+sizeof(UINT)],DataSize);???;  Assuming PackageData is an array of bytes, yep ;)Also if you want, you can write "PackageData+FileOffset+sizeof(UINT)" instead of "PackageData[FileOffset+sizeof(UINT)]".   ;  fmemopen() and open_memstream() does what you want, but I don't think it's standard C.   ;  Is it hard to get rid of the fread dependency? Like if you'd replace them with some more abstract streams. std or custom. You could replace all freads, and passing FILE pointers with something like:class input_stream{public:    virtual void read(void* destination, size_t bytes) = 0;};and the data could come from anywhere..   