#include "stdafx.h" #include #include using namespace std; void GetNext(ifstream &fin, char * ptr, int max) { char ch; int i = 0; do { fin>>ch; if (ch == 0 ) continue; ptr[i] = ch; i++; if (ch == '>') break; }while(!fin.eof() && i < max-1); ptr[i] = 0; } void PrintLink(char * str) { int i = 0; for (i = 0; i < strlen(str)-2; ++i) { if (str[i] == '"') { i++; break; } } for (; i < strlen(str)-3; ++i) { if (str[i] == '"') break; if (str[i] == '_' && str[i+2] == '.') { i+=2; } cout< 1) { strcpy(fileName, argv[1]); } else { cout<<"Enter input file name: "; gets(fileName); } ifstream fin(fileName); while(!fin.eof()) { GetNext(fin, line, size-5); if (strncmp(line, toFind, s-1) == 0 || strncmp(line, toFind1, s-1) == 0) { GetNext(fin, line, size-5); GetNext(fin, line, size-5); PrintLink(line); } } return 0; }