how to read files in evc++
Hi,
i am trying to check how long it takes to read files from sd card.
i create 100 files 10k each
for(i = 0;i<100;i++)
{
wsprintf(wszBuf, _T("%s\\Filetest_%d.txt"), g_szVolume, i);
RETAILMSG( 1, ( wszBuf ) );
RETAILMSG( 1, ( _T("\r\n") ) );
hFile = CreateFile(wszBuf, GENERIC_WRITE|GENERIC_READ, 0, NULL, CREATE_ALWAYS, 0, 0);
WriteFile(hFile, filedata, dwFileSize, &dwBytesWritten, NULL);
CloseHandle(hFile);
}
//end create file
dwStartTick = GetTickCount(); //Get initial tick count
//We are going to Open/Close the file for every file read.
for (i=0; i<dwInterval; i++)
{
wsprintf(wszBuf, _T("%s\\Filetest_%d.txt"), g_szVolume, i);
RETAILMSG( 1, ( wszBuf ) );
RETAILMSG( 1, ( _T("\r\n") ) );
hFile = CreateFile(wszBuf, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, 0);
if(!ReadFile(hFile, &filedata_readed, dwFileSize, &dwBytesWritten, NULL))
{
ShowLastError();
return(0);
}
CloseHandle(hFile);
}
dwEndTick = GetTickCount();
}
is it right way to do that?
How can i open directory and to get list of all files?
|