🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

mmio Help

Started by
1 comment, last by GameDev.net 24 years, 8 months ago
I think you are complicating things by using mmio API for things
not intended for multimedia.

Do this (no error checking):
---------------------------------
DATA mydata; // your structure
HANDLE hFile;
DWORD dwBytesRead;

// open the file
hFile = CreateFile("MYDATA.DAT", GENERIC_READ,
0, (LPSECURITY_ATTRIBUTES)NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, (HANDLE)NULL);

// fill in data struct
ReadFile(hFile, &mydata, sizeof(DATA, &dwBytesRead, NULL);
------------------------------------

You can then access your data structure by doing:
mydata.health and mydata.size

Heathen

Advertisement
Hey All,

Need a little help with the mmio functions. If I have a struct defined as thus:

typedef struct DATA {
int health;
int size;
};

and I use mmioOpen to open a file, how do I read it in right to the struct? Do I do this:

mmioRead(HMMIO waveHandle, DATA dataMember, sizeof(data));

If that is right, can I access the parts of a DATA struct like this:

dataMember.health = 100;

or something like that, or do I have to do something else to get the dataMember file ready to access?

I realize that mmio is mostly for things like .wav files, I'm just trying to simplify things.

Thanks,

Zachary

No, I'm going to use mmio for multimedia, that was just an example that I used to simplify things for discussion purposes only. That's why I need to know if that works, because a .wav file has a header section that contains the attributes of same file, and I have a struct to hold the .wav file data and need to know how to access it.

This topic is closed to new replies.

Advertisement