where is the mistake here?
-
TCHAR buffer [16384]; DWORD bufferSize = sizeof(buffer)/sizeof(buffer[0]); BOOL bRes = InternetGetCookie(("http://www.codeproject.com"), NULL, (LPWSTR)buffer, &bufferSize); DWORD ret; if(bRes==FALSE) { ret = ::GetLastError(); CString str; str.Format(_T("%d"),ret); MessageBox(NULL,str,NULL,MB_OK); MessageBox(NULL,_T("no items1"),NULL,MB_OK); if (ret == ERROR_NO_MORE_ITEMS) MessageBox(NULL,_T("no items"),NULL,MB_OK); else if(ret == ERROR_INSUFFICIENT_BUFFER) MessageBox(NULL,_T("insufficient buffer"),NULL,MB_OK); else if(ret == ERROR_INVALID_PARAMETER) MessageBox(NULL,_T("invalid parameters"),NULL,MB_OK); } else { MessageBox(NULL,buffer,NULL,MB_OK); } This code is displaying garbage value for buffer.But I need the cookie value.what to do?
-
TCHAR buffer [16384]; DWORD bufferSize = sizeof(buffer)/sizeof(buffer[0]); BOOL bRes = InternetGetCookie(("http://www.codeproject.com"), NULL, (LPWSTR)buffer, &bufferSize); DWORD ret; if(bRes==FALSE) { ret = ::GetLastError(); CString str; str.Format(_T("%d"),ret); MessageBox(NULL,str,NULL,MB_OK); MessageBox(NULL,_T("no items1"),NULL,MB_OK); if (ret == ERROR_NO_MORE_ITEMS) MessageBox(NULL,_T("no items"),NULL,MB_OK); else if(ret == ERROR_INSUFFICIENT_BUFFER) MessageBox(NULL,_T("insufficient buffer"),NULL,MB_OK); else if(ret == ERROR_INVALID_PARAMETER) MessageBox(NULL,_T("invalid parameters"),NULL,MB_OK); } else { MessageBox(NULL,buffer,NULL,MB_OK); } This code is displaying garbage value for buffer.But I need the cookie value.what to do?
rindam wrote:
what to do?
First, stop posting your question multiple times. Second, a previous reply already told you the data is encoded and gave you a link to read. If you want to develop software I suggest you stop typing questions into forums and start reading the documentation that is relevant to your task.