The mmioRead function reads a specified number of bytes from a file opened by using the mmioOpenfunction.
本函数读取指定数量的字节,从一个文件,使用mmioOpen函数.
Syntax
LONG mmioRead( HMMIO hmmio, HPSTR pch, LONG cch );
Parameters
-
hmmio
-
File handle of the file to be read.
文件句柄,被读取的文件的句柄
pch
-
Pointer to a buffer to contain the data read from the file.
指向一个缓冲区,包含/存放从文件读取的数据
cch
-
Number of bytes to read from the file.
要从文件读取的字节数
Return value
Returns the number of bytes actually read. If the end of the file has been reached and no more bytes can be read, the return value is 0. If there is an error reading from the file, the return value is –1.
返回实际读取的字节数.如果已经到达文件尾并且没有更多的字节可供读取,返回值为0,如果从文件读取时发生错误,返回值为-1
Requirements
Minimum supported client | Windows 2000 Professional |
---|---|
Minimum supported server | Windows 2000 Server |
Header |
|
Library |
|
DLL |
|
Send comments about this topic to Microsoft
Build date: 9/7/2011
http://msdn.microsoft.com/en-us/library/dd757334(v=VS.85).aspx?ppud=4
BOOL CAudioCtrl::ReadSoundDataFromFile(LPVOID data, int &size)
{
ASSERT ( data && size > 0 );
ASSERT ( m_hWaveFile[ENUM_FILE_CHANNEL_COMMON] );
return ( ( size = ::mmioRead ( m_hWaveFile[ENUM_FILE_CHANNEL_COMMON], (char*)data, size) ) > 0 );
}
/* 用mmioRead()读出WAVEFormatx结构数据 */
DWORD bytesRead = mmioRead ( m_hWaveFile[ENUM_FILE_CHANNEL_COMMON],(LPSTR)&m_Format,
m_MMCKInfoChild[ENUM_FILE_CHANNEL_COMMON].cksize );