W3C home > Mailing lists > Public > www-lib@w3.org > April to June 2000

whats wrong in "Fetching a URL " example

From: Arora Meenakshi <marora@redcreek.com>
Date: Tue, 2 May 2000 14:37:11 -0700
Message-ID: <B74EBB896D29D211A43E00805F650DF20119B810@mail.redcreek.com>
To: "'www-lib@w3.org'" <www-lib@w3.org>
hello
i am new to using LibWWW. could anyone of you help me out by telling why is
the foll. example not working  ..... its the same as in Libwww examples
#include "stdafx.h"
#include <iostream.h>

#include "WWWLib.h"
#include "WWWHTTP.h"
#include "WWWInit.h"
#include "WWWTrans.h"
#include "HTDialog.h"

#define HTTP_PORT	80

int main (int argc, char ** argv)
{
	HTRequest* request = HTRequest_new();
//	WWWTRACE = SHOW_ALL_TRACE;
	// initialie the library
	if(!(HTLibInit("FetchURL","1.0")))
	{
		cout<< "init. failed"<<"\n";
		return 0;
	}
	// register the library modules - protocol directly & in the for of
converters
//	HTProtocol_add("http",YES,HTLoadHTTP,NULL);
    HTProtocol_add("http", "buffered_tcp", HTTP_PORT, YES, HTLoadHTTP,
NULL);

	HTList *converters = HTList_new();

	
HTConversion_add(converters,"*/*","www/present",HTSaveLocally,1.0,0.0,0.0);
//
HTConversion_add(converters,"*/*","www/present",HTMLPresent,1.0,0.0,0.0);
	//register the list with converion
    HTConverterInit(converters);
	HTFormat_setConversion(converters);

	// prompt theuser for file name if not specified
	HTAlert_add(HTPrompt,HT_A_PROMPT);
	if(argc == 2)
		HTLoadAbsolute("http://www.msn.com",request);
	else
		printf("type the url to fetch\n");

	HTRequest_delete(request);
	HTConversion_deleteAll(converters);
	HTLibTerminate();
	return 0;

}

thanx
meenakshi
Received on Tuesday, 2 May 2000 17:37:49 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:36 GMT