我目前有一个基本上从网页上读到html的方案。 在寄送网站服务器后,我回了回复,我在那里用空话读了袖珍:
FILE *webpage = fdopen(socket, "r");
then I have a loop that uses fgets to get each line and then print them to a file:
while(!feof(webpage)){
fgets(newline, 1000, webpage);
fprintf ...
}
该方案的这一部分进行罚款。
HTTP/1.1 200 OK^M
Date: Fri, 18 Nov 2011 04:42:40 GMT^M
Server: Apache/2.2.14^M
Accept-Ranges: bytes^M
Cache-Control: max-age=0^M
Expires: Fri, 18 Nov 2011 04:42:40 GMT^M
Vary: Accept-Encoding^M
Content-Length: 345235^M
Connection: close^M
Content-Type: text/html^M
X-Pad: avoid browser bug^M
^M
<html lang="en">
<head>
...
I want to find this newline that is right under xpad, and insert something right when this newline is found (basically do something right after the headers are printed. However, I m not sure how to find the line, or what the ^Ms are for.
目前,我正在做像样的尝试。
if(newline == "
"){
...
}
or just " ", and it doesn t work. I think its got something to do with the ^M but I m not sure.
感谢!