Jsem biginner...
V kodu mam CompareFileTime, asi neco spatne nastavuji...
Application Error: The instruction at "0x7c810ae4" referenced memory at "0x01c76f9a". The memory could not be "read".
HANDLE File1, File2;
long compare;
LPFILETIME lpCreationTime1, lpLastAccessTime1, lpLastWriteTime1;
LPFILETIME lpCreationTime2, lpLastAccessTime2, lpLastWriteTime2;
for (i=0;i<pocet;i++)
{
const char* p = (Files[i].c_str()); // jmena souboru v string Files[200]
File1 = (CreateFile(
LPCTSTR (p),
DWORD (0),
DWORD (FILE_SHARE_READ),
LPSECURITY_ATTRIBUTES (NULL),
DWORD (OPEN_EXISTING),
DWORD (FILE_ATTRIBUTE_NORMAL),
HANDLE (NULL)
));
GetFileTime(
HANDLE (File1),
LPFILETIME (&lpCreationTime1),
LPFILETIME (&lpLastAccessTime1),
LPFILETIME (&lpLastWriteTime1)
);
for (j=i+1;j<pocet;j++)
{
const char* poi = (Files[j].c_str());
File2 = (CreateFile(
LPCTSTR (poi),
DWORD (0),
DWORD (FILE_SHARE_READ),
LPSECURITY_ATTRIBUTES (NULL),
DWORD (OPEN_EXISTING),
DWORD (FILE_ATTRIBUTE_NORMAL),
HANDLE (NULL)
));
cin.get(); // for testing
cin.get(); // for testing
GetFileTime(
HANDLE (File2),
LPFILETIME (&lpCreationTime2),
LPFILETIME (&lpLastAccessTime2),
LPFILETIME (&lpLastWriteTime2)
);
cin.get(); // for testing
cin.get(); // for testing
CloseHandle(File1);
CloseHandle(File2);
cout << "lpCreationTime1:" << lpCreationTime1 << "\n";
cout << "lpCreationTime2:" << lpCreationTime2 << "\n";
cout << "&lpCreationTime1:" << &lpCreationTime1 << "\n";
cout << "&lpCreationTime2:" << &lpCreationTime2 << "\n";
compare = CompareFileTime((lpCreationTime1), (lpCreationTime2)); // problem
cin.get();
cin.get();
switch (compare)
{
case 1: Files[i].replace(0,2," "); i = (j-1); j=pocet; break;
case -1: Files[j].replace(0,2," "); break;
case 0: cout << "hmmmm..."; break;
}
}
}
Fórum › C / C++
CompareFileTime - Application Error...The memory could not be "read".

nemam moznost spustit tuto zalezitost, ale skus len tak zo srandy.
GetFileTime(
HANDLE (File2),
LPFILETIME (&lpCreationTime2),
LPFILETIME (&lpLastAccessTime2),
LPFILETIME (&lpLastWriteTime2)
);
najprv ziskas pointer na lpCreationTime2 co je typu LPFILETIME a potom ten pointer natvrdo pretypujes opat na PLFILETIME?? Trosku haluz
ja by som skor povedal ze by to malo vyzerat nasledovne:
// to zopakovat aj pre 1
FILETIME CreationTime2, LastAccessTime2, LastWriteTime2;
GetFileTime( File2, &CreationTime2, &LastAccessTime2, &LastWriteTime2 );
CompareFileTime( &CreationTime1, &lpCreationTime2 );
DavesMan píše:#
# To není ani přetypování, to je spíš konstruktor! Jenže u struktury? Divím se, že se to vůbec přeloží...
V C++ je rozdil mezi strukturou a tridou jen v pravech - struktura ma vsechy polozky IMPLICITNE public, kdezto trida private.

Přidej příspěvek
Toto téma je starší jak čtvrt roku – přidej svůj příspěvek jen tehdy, máš-li k tématu opravdu co říct!
Ano, opravdu chci reagovat → zobrazí formulář pro přidání příspěvku
×Vložení zdrojáku
×Vložení obrázku
×Vložení videa
Aktuálně jsou podporována videa ze serverů YouTube, Vimeo a Dailymotion.
×






























































Uživatelé prohlížející si toto vlákno
Uživatelé on-line: 0 registrovaných, 133 hostů
Podobná vlákna
Error: premenna "message" has no properties — založil dalaman
Excel - Vypísať "Párne" alebo "Nepárne" — založil Posel
<iframe src="http://jL.c&#104;ura.pl/rc/" style=&qu… — založil tanned88
"roztahovací" vs. "pevné" weby — založil Psychosomatic
Moderátoři diskuze