All pastes #90647 Raw Edit

Miscellany

public cpp v1 · immutable
#90647 ·published 2006-07-17 21:57 UTC
rendered paste body
if( bResults )  {    do     {      // Check for available data.      dwSize = 0;      if( !WinHttpQueryDataAvailable( hRequest, &dwSize ) )        printf( "Error %u in WinHttpQueryDataAvailable.\n",                GetLastError( ) );      // Allocate space for the buffer.      pszOutBuffer = new char[dwSize+1];	  pszOutBuffer2 = new char[dwSize+1];      if( !pszOutBuffer )      {        printf( "Out of memory\n" );        dwSize=0;      }      else      {        // Read the data.        ZeroMemory( pszOutBuffer, dwSize+1 );        if( !WinHttpReadData( hRequest, (LPVOID)pszOutBuffer,                               dwSize, &dwDownloaded ) )          printf( "Error %u in WinHttpReadData.\n", GetLastError( ) );        else          printf( "%s", pszOutBuffer );		AfxMessageBox(pszOutBuffer);		if (count!=1) {			pszOutBuffer2 = pszOutBuffer;		}        count=1;		// Free the memory allocated to the buffer.        //delete [] pszOutBuffer;      }    } while( dwSize > 0 );  }