MT4 DLL 调用问题
Dear all:初次发贴,多多关照! 各位高手 帮我解答个问题 我利用Mt4 例子程序生成DLL想实现文件的copy
创建了下面一个函数 mt4 在调用的时候 平台死掉 是啥原因呢
//=======================================================
MT4_EXPFUNC bool __stdcall Mt4CopyFile(char *s,char *d)
{
FILE *fp1,*fp2;
if((fp1=fopen(s,\"r\"))==NULL)
{
printf(\"Cannot open Source file!n\");
exit(0);
}
if((fp2=fopen(d,\"w\"))==NULL)
{
printf(\"Cannot open Destination file!n\");
exit(0);
}
while(!feof(fp1))
fputc(fgetc(fp1),fp2);
fclose(fp1);
fclose(fp2);
return 0;
}
//=============================
下面是源码
//+------------------------------------------------------------------+
//| Sample DLL for MQL4 |
//| Copyright ?2004-2006, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#define WIN32_LEAN_AND_MEAN// Exclude rarely-used stuff from Windows headers
#include
#include
#include
//----
#define MT4_EXPFUNC __declspec(dllexport)
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#pragma pack(push,1)
struct RateInfo
{
unsigned int ctm;
double open;
double low;
double high;
double close;
double vol;
};
#pragma pack(pop)
//----
struct MqlStr
{
int len;
char *string;
};
static int CompareMqlStr(const void *left,const void *right);
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
BOOL APIENTRY DllMain(HANDLE hModule,DWORD ul_reason_for_call,LPVOID lpReserved)
{
//----
switch(ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
//----
return(TRUE);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
MT4_EXPFUNC int __stdcall GetIntValue(const int ipar)
{
printf(\"GetIntValue takes %dn\",ipar);
return(ipar);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
MT4_EXPFUNC double __stdcall GetDoubleValue(const double dpar)
{
printf(\"GetDoubleValue takes %.8lfn\",dpar);
return(dpar);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
MT4_EXPFUNC char* __stdcall GetStringValue(char *spar)
{
printf(\"GetDoubleValue takes \"%s\"n\",spar);
return(spar);
}
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
MT4_EXPFUNC double __stdcall GetArrayItemValue(const double *arr,const int arraysize,const int nitem)
{
//----
if(arr==NULL)
{
printf(\"GetArrayItemValue: NULL arrayn\");
return(0.0);
}
if(arraysize 嘿嘿 厉害!强~~~~没的说了! 围观来了哦 貌似我真的很笨????哎 今天再看下 先看看怎么样! 我有个群,大家一起来讨论EA. 看看是什么东西啊
继续,学习了
页:
[1]
2