Click here to Skip to main content
15,924,036 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: scanf () loop question. Pin
David Crow1-May-07 2:16
David Crow1-May-07 2:16 
QuestionRe: scanf () loop question. Pin
James R. Twine1-May-07 2:40
James R. Twine1-May-07 2:40 
AnswerRe: scanf () loop question. Pin
David Crow1-May-07 2:52
David Crow1-May-07 2:52 
QuestionNeed some suggestions. C programming Pin
C_Zealot30-Apr-07 16:33
C_Zealot30-Apr-07 16:33 
AnswerRe: Need some suggestions. C programming Pin
C_Zealot30-Apr-07 16:37
C_Zealot30-Apr-07 16:37 
AnswerRe: Need some suggestions. C programming Pin
David Crow30-Apr-07 17:19
David Crow30-Apr-07 17:19 
GeneralRe: Need some suggestions. C programming Pin
C_Zealot30-Apr-07 17:21
C_Zealot30-Apr-07 17:21 
QuestionNot working Pin
dellthinker30-Apr-07 12:29
dellthinker30-Apr-07 12:29 
Hi all. Im having trouble with a DNS client. I spent a great deal of time trying to figure out a few little things and now its not even doing what i want.

My code:

<br />
#include <iostream><br />
#include <winsock2.h><br />
using namespace std;<br />
<br />
main(){<br />
	const int SIZE=100;<br />
	char msg[SIZE];<br />
	WORD wVersionRequested;<br />
	WSADATA wsa;<br />
	struct hostent *host;<br />
	printf("Please enter the Host name to look up.\n");<br />
	cin.getline(msg, SIZE);<br />
	printf("Doing a DNS lookup of '%s'\n",msg);<br />
	wVersionRequested=MAKEWORD(2, 0);<br />
	WSAStartup(wVersionRequested, &wsa);<br />
	host=gethostbyname(msg);<br />
	if((host = gethostbyname(msg)) == NULL)<br />
	{<br />
		printf("DNS Lookup of '%s' failed!\n",msg);<br />
	}<br />
	else<br />
	{<br />
		printf("DNS Results are: '%s'\n",host);<br />
	}<br />
	WSACleanup();<br />
	system("pause");<br />
	return 0;<br />
}<br />


Took me a half a hour to figure out how to initialize wVersionRequested. Now it compiles with a charm. however it doesnt do a DNS lookup. In fact its only printing out useless information. Whats am i missing? Thanx in advance!
AnswerRe: Not working [modified] Pin
Mark Salsbery30-Apr-07 13:11
Mark Salsbery30-Apr-07 13:11 
GeneralRe: Not working Pin
dellthinker1-May-07 7:07
dellthinker1-May-07 7:07 
GeneralRe: Not working Pin
Mark Salsbery1-May-07 7:15
Mark Salsbery1-May-07 7:15 
QuestionActive X Controls not working Pin
brdavid30-Apr-07 11:56
brdavid30-Apr-07 11:56 
Questionimage processing with inbuilt libraries. Pin
Evil Bluez30-Apr-07 11:46
Evil Bluez30-Apr-07 11:46 
AnswerRe: image processing with inbuilt libraries. Pin
jk chan30-Apr-07 16:09
jk chan30-Apr-07 16:09 
GeneralRe: image processing with inbuilt libraries. Pin
Evil Bluez1-May-07 11:16
Evil Bluez1-May-07 11:16 
GeneralRe: image processing with inbuilt libraries. Pin
jk chan1-May-07 14:35
jk chan1-May-07 14:35 
AnswerRe: image processing with inbuilt libraries. Pin
mt_samiei30-Apr-07 21:44
mt_samiei30-Apr-07 21:44 
Questionwhich is the difference from a unicode project and another one that is not unicode Pin
Joan M30-Apr-07 10:43
professionalJoan M30-Apr-07 10:43 
AnswerRe: which is the difference from a unicode project and another one that is not unicode Pin
Mark Salsbery30-Apr-07 12:04
Mark Salsbery30-Apr-07 12:04 
AnswerRe: which is the difference from a unicode project and another one that is not unicode Pin
Michael Dunn30-Apr-07 12:39
sitebuilderMichael Dunn30-Apr-07 12:39 
QuestionVS.Net Resource Editor issue Pin
hro_external30-Apr-07 9:18
hro_external30-Apr-07 9:18 
JokeRe: VS.Net Resource Editor issue Pin
Joan M30-Apr-07 9:34
professionalJoan M30-Apr-07 9:34 
AnswerRe: VS.Net Resource Editor issue Pin
S Douglas30-Apr-07 23:39
professionalS Douglas30-Apr-07 23:39 
QuestionUSB phone LCD display interface Pin
Spy_Tech30-Apr-07 9:13
Spy_Tech30-Apr-07 9:13 
QuestionExcel Automation Pin
prithaa30-Apr-07 9:05
prithaa30-Apr-07 9:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.