/[projects]/misc/bashloader/readUrl.cpp
ViewVC logotype

Contents of /misc/bashloader/readUrl.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 547 - (show annotations) (download)
Sun Jan 24 15:38:37 2010 UTC (14 years, 3 months ago) by torben
File size: 549 byte(s)
Found another old project laying around
1
2
3 #include <string>
4 #include <fstream>
5 #include <iostream>
6 #include <stdlib.h>
7 #include "readUrl.h"
8
9
10 using namespace std;
11
12 string readUrl(const string &url)
13 {
14 char buf[128000];
15 string document;
16
17 string command = "wget -O /tmp/urlload.html -o /tmp/urlload.log \"";
18 command += url;
19 command += "\"";
20 system(command.c_str() );
21 ifstream in("/tmp/urlload.html");
22
23 if (!in)
24 return "";
25
26 while (!in.eof() )
27 {
28 in.getline(buf,128000-1);
29 document += buf;
30 document += "\n";
31 }
32 in.close();
33 unlink("/tmp/urlload.html");
34
35 return document;
36 }

  ViewVC Help
Powered by ViewVC 1.1.20