DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

CGI Ipaddress

03.07.2009
| 2884 views |
  • submit to reddit
        /* This is a CGI program that prints out the IP address 
 * of the requester.
 */
#include <stdio.h>
#include <stdlib.h>

int main (int argc, char *argv[], char *envp[])
{
  char *REMOTE_ADDR;

  printf("Content-type: text/plain \n\n");
  printf("%s",getenv("REMOTE_ADDR"));
  
  return 0;
}