|
Still confusing,
Goto Project->Settings->C/C++->Precompiled Headers
Select Automatic use of Precompiled Headers.
Thanks.
The Phantom.
|
|
|
|
|
Thanks. I fixed my problem. You say precompiled header files will speed up or slow down compile?
|
|
|
|
|
When the .PCH file is being created, the compile time will take longer. Subsequent compiles will be much shorter. If, however, you have a small project, the difference will not be noticeable.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Very easy, add
#include "stdafx.h"
to the files that give those errors.
Make sure it's the first #include though.
|
|
|
|
|
Hi, i have a question abt displaying doubles. Under _MBCS the following codes work but how do i display the double under Unicode? Thanks!
char *buffer;
int decimal, sign;
buffer = _ecvt( m_Height, 5, &decimal, &sign );
AfxMessageBox(buffer);
or
int decimal, sign;
AfxMessageBox(_ecvt(m_Height, 5, &decimal, &sign);
|
|
|
|
|
|
|
How about ansi.org?
Bernd
|
|
|
|
|
|
Only compiler designers and people with a strange liking for dull reading need it anyway.
Bernd
|
|
|
|
|
hi..
can someone tell me how do i get the IP address of my own PC???
tks a lot...
With Regards
Joseph R. Thomas
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
|
|
|
|
|
....
char host[80];
gethostname(host,80);
LPHOSTENT lpHost;
lpHost = gethostbyname(host);
UINT ip = ((LPIN_ADDR)lpHost->h_addr)->s_addr;
....
|
|
|
|
|
nope...doesnt work!!!
With Regards
Joseph R. Thomas
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
|
|
|
|
|
Try initializing winsock first:
#include "Winsock2.h"
#pragma comment(lib,"Ws2_32.lib")
int main(int argc, char* argv[])
{
WORD wVersionRequested;
WSADATA wsaData;
int err;
wVersionRequested = MAKEWORD( 2, 2 );
err = WSAStartup( wVersionRequested, &wsaData );
if ( err != 0 ) {
return -1;
}
char host[80];
gethostname(host,80);
LPHOSTENT lpHost;
lpHost = gethostbyname(host);
UINT ip = ((LPIN_ADDR)lpHost->h_addr)->s_addr;
char* addr= inet_ntoa(*(LPIN_ADDR)lpHost->h_addr);
return 0;
}
John
|
|
|
|
|
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . :
Autoconfiguration IP Address. . . : 169.254.159.128
Subnet Mask . . . . . . . . . . . : 255.255.0.0
Default Gateway . . . . . . . . . :
PPP adapter PacNet:
Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 210.24.247.6
Subnet Mask . . . . . . . . . . . : 255.255.255.255
Default Gateway . . . . . . . . . : 210.24.247.6
the codes u gave me are fetching Autoconfiguration IP Address i.e 169.254.159.128
what i need is IP Address i.e 210.24.247.6
can someone please help???
With Regards
Joseph R. Thomas
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
|
|
|
|
|
Joseph_R_Thomas wrote:
can someone please help???
The problem is you have more than one ip address. The code above will return the first.
replace h_addr in the previous examples with h_addr_list[1] to get the second.
John
|
|
|
|
|
|
but what if the program keeps on shifting from one machine to another where some machine have more than one IP addresses and soem have only one????
With Regards
Joseph R. Thomas
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
|
|
|
|
|
It gets very complicated. Any network adapter may have multiple IP addresses. A computer may have more than one network adapters. I am not sure how you can figure out which ip address is the one that is connected to the internet and actually more than one can be connected to the internet.
You can use this code to go through the list of ip addresses:
#include "Winsock2.h"
#pragma comment(lib,"Ws2_32.lib")
int main(int argc, char* argv[])
{
WORD wVersionRequested;
WSADATA wsaData;
int err;
wVersionRequested = MAKEWORD( 2, 2 );
err = WSAStartup( wVersionRequested, &wsaData );
if ( err != 0 ) {
return -1;
}
char host[80];
gethostname(host,80);
LPHOSTENT lpHost;
lpHost = gethostbyname(host);
for(int i=0;(LPIN_ADDR)lpHost->h_addr_list[i] != 0;i++) {
UINT ip = ((LPIN_ADDR)lpHost->h_addr_list[i])->s_addr;
char* addr= inet_ntoa(*(LPIN_ADDR)lpHost->h_addr_list[i]);
}
return 0;
}
John
|
|
|
|
|
but then how to select the correct one????
With Regards
Joseph R. Thomas
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
|
|
|
|
|
Joseph_R_Thomas wrote:
but then how to select the correct one????
They are all correct. I will explain. Think about the case where there is a lan connected to one network adapter and a second network adapter is conected to the internet using a dsl modem. One ip adddress will work to talk to the other pcs on the lan. The other ip address will work for the internet.
I assume you mean the one connected to the internet?? I am not sure.
John
|
|
|
|
|
u see..in my school its al connected to lan so there is only one ip..
at my house however as i showed you in the first or second post..there are more than one IP Address....in this case i need the IP Address that connects to the internet...the one that is called IP Address not AutoConfiguration IP Address.....
so in school the codes work fine..but at home...i got prob since i need to select the IP Address not the Auto config IP Address....
With Regards
Joseph R. Thomas
Have a Super Blessed Day!
-------------------------
For God has not given us a spirit of fear, but of power and of love and of a sound mind.
2 Timothy 1:7
|
|
|
|
|
I might be on the wrong track here but when you call bind on a socket you can specify ADDR_ANY for the ip address. Then, windows will sort out which actual IP address to use based on routing information - this saves you having to manually determine which IP address you need to select.
Phil
|
|
|
|
|
I was thinking the same. It depends why he wants the address.
John
|
|
|
|
|
recently i work on oledb&sqlserver, for some reason , i use many unregular table name just like guid, for example: 4DACE4ED-55A9-4F9C-9270-CE73CBF067F3.
there is no problem on my computer at all, but yesterday i install the application on an other machine, it does not work anymore,so i debuged the program on that machine and found that creating table is ok, but error occurs while opening a table with such unregular name. can anyone please tell me what the reason?
should i need any aditional package?
many thanks
|
|
|
|