예제 #1
0
string getUVALineFromFile(char *filename) {
    string res="",ts;
    FILE * fp=fopen(filename,"r");
    while (fgets(tmps,1000000,fp)) {
        res=tmps;
        if (res.find("<input type=\"hidden\" ")==0) {
            while (fgets(tmps,1000000,fp)) {
                ts=tmps;
                if (ts.find("<input type=\"hidden\" ")==string::npos) break;
                res=res+ts;
            }
            break;
        }
    }
    fclose(fp);
    int loc=0,tp;
    // cout<<res;
    string rres="";
    while ((loc=res.find("name=\"",loc))!=string::npos) {
        loc=loc+strlen("name=\"");
        tp=res.find("\"",loc);
        //cout <<loc <<" " << tp <<" "<<res.substr(loc,tp-loc)<<endl;
        rres=rres+escapeURL(res.substr(loc,tp-loc));
        loc=res.find("value=\"",tp);
        loc=loc+strlen("value=\"");
        tp=res.find("\"",loc);
        //cout <<loc <<" " << tp <<" "<<res.substr(loc,tp-loc)<<endl;
        rres=rres+"="+escapeURL(res.substr(loc,tp-loc))+"&";
    }
    return rres;
}
예제 #2
0
string getFirstFromFile(char *filename) {
    string res=getAllFromFile(filename);
    int loc=res.find("<tr class=\"sectiontableentry1\">");
    loc+=strlen("<tr class=\"sectiontableentry1\">");
    int loc2=res.find("</tr>",loc);
    //cout<<res.substr(loc,loc2-loc)<<endl<<"===="<<endl;
    return res.substr(loc,loc2-loc);
}
예제 #3
0
파일: test.cpp 프로젝트: jie414341055/toj
string getLineFromFile(char *filename,int line) {
	string res="";
	FILE * fp=fopen(filename,"r");
	int cnt=0;
	while (fgets(tmps,10000000,fp)) {
		cnt++;
		//        g2u(tmps,strlen(tmps),outs,1000000);
		res=tmps;
		if (res.find("<h1>Realtime Status</h1>")!=string::npos) {
			fgets(tmps,10000000,fp);
			//            g2u(tmps,strlen(tmps),outs,1000000);
			res=res+tmps;
			fgets(tmps,10000000,fp);
			//            g2u(tmps,strlen(tmps),outs,1000000);
			res=res+tmps;
			break;
		}
	}
	fclose(fp);
	return res;
}
예제 #4
0
string getResFromFile(char *filename) {
    string res=getAllFromFile(filename);
    int st=res.find("<td style=\"text-align: center;\">");
    int pos=res.find("</tr>",st);
    return res.substr(st,pos-st);
}
예제 #5
0
파일: fzuhandler.cpp 프로젝트: himcc/bnuoj
string getResFromFile(char *filename) {
    string res=getAllFromFile(filename);
    int st=res.find("<tr onmouseover=");
    int pos=res.find("</tr>",st);
    return res.substr(st,pos-st);
}