PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : [c++] Fehlerbehebung



c4pone
13.07.2007, 13:22
Kann mir jemand sagen wo ich hier den Fehler gemacht hab weil iergendwie will mein complire nicht so wie ich will ...

Complire : Microsoft Visual C++ 6.0



#include <afxinet.h>
#include <iostream.h>
void main(void)
{
CInternetSession is("HTTPGET");
CHttpConnection *pHC = NULL;
CHttpFile *pHF =NULL;
try
{
pHC = is.GetHttpConnection(_T("www.google.com"));
pHF = pHC->OpenRequest(_T(""),_T("/default.asp"),NULL, 0, NULL, NULL, 0);
pHF->SendRequest();
char c;
while (pHF->Read(&c, 1) == 1) cout << c;
pHF->Close();
pHC->Close();
}
catch (CInternetException *pIE)
{
cout << "Internet error " << pIE->m_dwError << "." << endl;
}
delete pHF;
delete pHC;
}


error C2228: Der linke Teil von '.GetHttpConnection' muss eine Klasse/Struktur/Union sein

-[RiDER]-
24.07.2007, 12:38
Soweit ich weiß, returnen viele klassen keine zeiger, sondern kopien von ner variable. also:
#include <afxinet.h>
#include <iostream.h>
void main(void)
{
CInternetSession is("HTTPGET");
CHttpConnection pHC = NULL;
CHttpFile *pHF =NULL;
try
{
pHC = is.GetHttpConnection(_T("www.google.com"));
pHF = pHC->OpenRequest(_T(""),_T("/default.asp"),NULL, 0, NULL, NULL, 0);
pHF->SendRequest();
char c;
while (pHF->Read(&c, 1) == 1) cout << c;
pHF->Close();
pHC->Close();
}
catch (CInternetException *pIE)
{
cout << "Internet error " << pIE->m_dwError << "." << endl;
}
delete pHF;
delete pHC;
}habs nich getestet...

MfG RiDER