Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #define makework
- int main (){
- char *str ="HTTP/1.0 200 OK\n"
- "Date: Thu, 26 Apr 2012 20:57:31 GMT\n"
- "Server: Apache/2.2.16 (Debian)\n"
- "X-Powered-By: PHP/5.3.3-7+squeeze4ex1\n"
- "Vary: Accept-Encoding\n"
- "Content-Length: 88\n"
- "Connection: close\n"
- "Content-Type: text/html\n"
- "\n"
- #ifdef makework
- "success\n"
- #else
- "failure\n"
- #endif
- "blahblahblah";
- // 1. search for success:
- char *content = strstr(str,"success");
- // 2. Check for success vs fail
- if (content != NULL){
- content += 8;
- printf("%s", content);
- // Content is now a string pointer with your content
- }
- else {
- printf("herpderp");
- // was a failure. :(
- }
- getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment