ok, i'm using memcpy to try and pull out some data from an array of unsigned chars.
the way i'm doing this is: i read data from a file and put it in to a dynamically allocated array of unsigned chars.
Then, when i need something out of it, i do a memcpy to get the data.
Now, the way i'm trying to do this is, the files themselves have a bunch of unsigned ints and floats in them, so i need to do a memcpy like so:
memcpy(floatVar, data, sizeof(float));
or something like that. But when i try and do that, it won't compile. So, then i add a (void*) to the beginning of floatVar, and it compiles fine, but when i run the program, it crashes........rarg!!!
anyone know how to copy memory over to a float variable?
or should i just do it the "old-fashioned" way and just do everything AS i'm reading in the file? (the reason I'm doing it this way is so that if the program crashes mid-read, it won't lose the file data....)