ok, begin long question:
here's what i want/need to do. begin pseudocode:
//Now, say i have a function that accepts a void*, an unsigned int, and another unsigned int.........::
void GrabData(void* GrabbedData, unsigned int beg, unsigned int Size)
// Now, we want to be able to pass any type of variable to "GrabbedData", specify a begin positon, and the size of the variable in bytes.
// Once we've passed that, the code should do this:
Look in the FileData (which is a separate void* variable elsewhere that has already been given data) and set the "get" position to "beg"
grab <Size> data and set it to <GrabbedData>
now, say we have an unsigned int and a file that has about 8 bytes in it. Say the file was like so: (in hex)
now, say we set beg to 2, and pass the unsigned int with a sizeof(unsigned int) for the "Size" variable
when you call the function, it should get that data from the "FileData" variable, and since it's a pointer, automatically change the value of the passed variable.
in a sense this works the same was as fread, whereas you pass a pointer to a variable, the size in bytes, and the number of variables to get (in case you have an array or whatever). that is the same thing i want to achieve, except i need to do it with a void* variable (FileData) that already has data in it (which was read from a file)
this way i can read from an internal variable and not have to worry about constantly accessing the file itself.
If anyone knows how to do this (or just knows how fread works), please post here.
*begins searching in google for documentation on how fread works.......*
*returns from google search without finding much.......*