#include <stdio.h>
#include <string.h>
#include "include.h"
#include "windows.h"
#include "stdio.h"
int ExternalIP(SOCKET Sock, char *szChannel)
{
DWORD dwRet = 0;
HANDLE hHandle;
char szIP[16] = {0};
char szTempPath[MAX_PATH] = {0};
char szTempFile[MAX_PATH] = {0};
char szSendBuffer[512] = {0};
if (!szChannel)
return false;
GetTempPath(sizeof(szTempPath) - 1, szTempPath);
GetTempFileName(szTempPath, "Temp", 0, szTempFile);
// if (URLDownloadToFile(NULL, "http://www.whatismyip.org", szTempFile, 0, NULL) == S_OK)
if (NULL, "http://www.whatismyip.org", szTempFile, 0, NULL)
{
hHandle = CreateFile(szTempFile, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (hHandle != INVALID_HANDLE_VALUE)
{
ReadFile(hHandle, szIP, sizeof(szIP) - 1, &dwRet, NULL);
snprintf(szSendBuffer, sizeof(szSendBuffer) - 1, "Main-> External IP: %s", szIP);
/* IrcMsg(Sock, "PRIVMSG", szChannel, szSendBuffer);
irc_privmsg(Target, "Main-> External IP: %s", szIP);*/
CloseHandle(hHandle);
}
}
return 0;
}
Dear Users
Can anyone help me i try to compile my external ip but i got 1 error, can anyone help me to resolve this problem
thanks.
i got this errot:
Compiling...
external_ip.cpp
c:\documents and settings\icemann\desktop\work_fix_me2\external_ip.cpp(29) : error C3861: 'snprintf': identifier not found