An illegal operation message
This is my code:
Code:
#include <string>
#include <windows.h>
#include <iostream>
#include <algorithm>
using namespace std;
bool DownloadFile(LPCTSTR URL , LPCTSTR LocalFilename);
typedef long (WINAPI * MYPROC)(long,LPCTSTR,LPCTSTR,DWORD,long);
bool DownloadFile(LPCTSTR URL , LPCTSTR LocalFilename)
{
long lngRetVal;
HMODULE hinstLib;
MYPROC ProcAdd;
BOOL fFreeResult, fRunTimeLinkSuccess = FALSE;
hinstLib = LoadLibrary("urlmon.dll");
if(hinstLib != NULL)
{
ProcAdd = (MYPROC) GetProcAddress(hinstLib, "URLDownloadToFileA");
if (NULL != ProcAdd)
{
fRunTimeLinkSuccess = TRUE;
lngRetVal = ProcAdd(0, URL, LocalFilename, 0, 0);
fFreeResult = FreeLibrary(hinstLib);
}
}
}
int main(){
string man;
char est[200];
cout<<"Tere tulemast!";
cin.getline(est,200,'\n');
cout<<"test1";
man=strcat("http://maxorator.farvista.net/man.php?red=",est);
cout<<"test2";
char shelp[200];
*(std::copy(man.begin(), man.end() - man.begin() < 200 ? man.end() : man.begin() + 199, shelp)) = 0;
LPCTSTR URL = shelp;
DownloadFile(URL,"C:\\My Documents\\temp2.abc");
}
It only couts test1, so that means the problem must be in this line:
Code:
man=strcat("http://maxorator.farvista.net/man.php?red=",est);
If I tried to use debug, it displayed the blue screen and closed my compiler(Dev-C++).
Any ideas?