parselink.cpp

来自「此源码功能是捕获网页中的链接并进行分析」· C++ 代码 · 共 56 行

CPP
56
字号
/***************************************************************************                          ParseLink.cpp  -  description                             -------------------    begin                : April 3, 2005    ParseLink: Parse linkss from raw data.    usage: ParseLink SrcFile ***************************************************************************/#include "WebDataFile.h"#include <sys/types.h>#include <sys/stat.h>#include <unistd.h>#include <dirent.h>#include <iostream>#include <string>#include <vector>#include <cstdlib>#include <time.h>using namespace std;int main(int argc, char* argv[]){	if( argc != 2 ){		cout << "ExtractUrl: Extract Urls from raw data." << endl;		cout << "usage:\t ExtractUrl RawDataFile" << endl;		return -1;	}	//InitDataBuffer	CWebDataFile iWebDataFile;        	if(! iWebDataFile.InitDataBuffer()){                std::cerr << "Insuficient memory.\n";		return -2;        }       		//OpenFile	char* sFileName = argv[1];	if(! iWebDataFile.OpenFile(sFileName)){		cout << "Fail to open file \"" << sFileName << "\"" << endl;                        return -3;	}	//cout << "Open file " << sFileName << "...\n";	while(true){		// Get a page object to process		if(! iWebDataFile.GetAWebPage((string)argv[1])){			cout << "Error: GetAWebPage() returned a false!" << endl;			break;		}	}	iWebDataFile.CloseFile();}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?