C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 10th, 2013, 02:08 AM
gurukrupa_1989 gurukrupa_1989 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2012
Posts: 25 gurukrupa_1989 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 53 m 34 sec
Reputation Power: 0
Need help for a problem

I am trying to get the IP address from the getenv but I am geting the out put as null for the REMOTE_ADDR and for HTTP_COOKIE. Bellow is my code..

Code:
#include <stdio.h>
#include<conio.h>
#include <windows.h>
#include <stdlib.h>

int main()
{
	char *lp_ip	;
	char *lp_cookie;
	char *path;
	char *lib;

	lp_ip			= getenv ("REMOTE_ADDR");
	lp_cookie		= getenv ("HTTP_COOKIE");	
	path			= getenv ("PATH");
	lib				= getenv ("LIB");

	printf("%s\n",lp_ip);
	printf("%s\n",lp_cookie);
	printf("%s\n",path);
	printf("%s\n",lib);
	return 0;

}

Reply With Quote
  #2  
Old January 10th, 2013, 03:49 AM
salem's Avatar
salem salem is offline
Contributed User
Click here for more information
 
Join Date: Jun 2005
Posts: 3,836 salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)salem User rank is General 12nd Grade (Above 100000 Reputation Level)  Folding Points: 153 Folding Title: Novice Folder
Time spent in forums: 2 Months 3 Weeks 2 Days 16 h 15 m 5 sec
Reputation Power: 1774
Are you writing a Common Gateway Interface(CGI) program?

The CGI wrapper provides you with a whole bunch of environment variables.

If you're not, then you have a fundamental mis-understanding of the problem (and we've no idea what that problem is).
__________________
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper

Reply With Quote
  #3  
Old January 10th, 2013, 05:30 AM
gurukrupa_1989 gurukrupa_1989 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2012
Posts: 25 gurukrupa_1989 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 h 53 m 34 sec
Reputation Power: 0
Yes, I am writing the CGI program. rather there is reference code but when I am trying to do a test program(the one above ) its not giving me the IP.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > Need help for a problem

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap