char pDowndsBuff[65536*4];
int nDownLen;
int ret;
int nUpType;
int ch,status;
char Buff[256];
unsigned char PlayBuff[64];
char appPath[256];
CString ReadFileData,FileName,ptr,kptr;
CTime time;
CStdioFile CMfile;
ret = 0;nUpType=0;ch=0;status=1;time=CTime::GetCurrentTime();
memset(Buff,0,sizeof(Buff));
sprintf(Buff,"%04d%02d%02d%02d%02d%02d", time.GetYear(),time.GetMonth(),time.GetDay(),time.GetHour(),time.GetMinute(),time.GetSecond());
Buff[14]=0x00;
ReadFileData.Format("%s",Buff);nUpType = 0xA5;
memset(pDowndsBuff,0,sizeof(pDowndsBuff));
nDownLen=14;
ret=PC_Send_To_PCA(nUpType,Buff,nDownLen);//PC_Send_To_PCA函数直接写
Sleep(3000);ptr.Format("%s",pDowndsBuff);
memset(appPath,0,sizeof(appPath));
Buff[23]=0x00;
ptr.Format("%02X %02X",pDowndsBuff[0],pDowndsBuff[1]);
if(memcmp(pDowndsBuff,"\x00\x00",2) == 0)
{
m_DisplayTrans.SetWindowText("上传数据完成!!!");
break;
}
memcpy(mFileBuff,pWriteBuff,mWrietLen);//=======主要是对上面C++函数对应的Delphi函数以及用法说明清楚点 谢谢!!!
int nDownLen;
int ret;
int nUpType;
int ch,status;
char Buff[256];
unsigned char PlayBuff[64];
char appPath[256];
CString ReadFileData,FileName,ptr,kptr;
CTime time;
CStdioFile CMfile;
ret = 0;nUpType=0;ch=0;status=1;time=CTime::GetCurrentTime();
memset(Buff,0,sizeof(Buff));
sprintf(Buff,"%04d%02d%02d%02d%02d%02d", time.GetYear(),time.GetMonth(),time.GetDay(),time.GetHour(),time.GetMinute(),time.GetSecond());
Buff[14]=0x00;
ReadFileData.Format("%s",Buff);nUpType = 0xA5;
memset(pDowndsBuff,0,sizeof(pDowndsBuff));
nDownLen=14;
ret=PC_Send_To_PCA(nUpType,Buff,nDownLen);//PC_Send_To_PCA函数直接写
Sleep(3000);ptr.Format("%s",pDowndsBuff);
memset(appPath,0,sizeof(appPath));
Buff[23]=0x00;
ptr.Format("%02X %02X",pDowndsBuff[0],pDowndsBuff[1]);
if(memcmp(pDowndsBuff,"\x00\x00",2) == 0)
{
m_DisplayTrans.SetWindowText("上传数据完成!!!");
break;
}
memcpy(mFileBuff,pWriteBuff,mWrietLen);//=======主要是对上面C++函数对应的Delphi函数以及用法说明清楚点 谢谢!!!
//这一部分是定义
pDowndsBuff : array [0..65536 * 4 -1] of Char;
nDownLen : Integer;
ret : Integer;
nUpType : Integer;
ch, status : Integer;
Buff : array [0..255] of Char;
PlayBuff : array [0..63] of Byte;
appPath : array [0..255] of Char;
ReadFileData, FileName, ptr, kptr : String;
time : TSystemTime;
TimeStr : String;
CMfile : TextFile;
//定义结束
ret := 0; nUpType := 0; ch := 0; status := 1;
GetLocalTime(Time);//取当前系统时间
FillChar(Buff[Low(Buff)],Length(Buff) * SizeOf(Buff[Low(Buff)]),0);//把Buff数组清空为0
TimeStr := Format('%.4d',[Time.wYear])+ Format('%.2d',[Time.wMonth]) +
Format('%.2d',[Time.wDay]) + Format('%.2d',[Time.wHour]) +
Format('%.2d',[Time.wMinute]) + Format('%.2d',[Time.wSecond]);
ShowMessage(TimeStr);
Buff[14] := '0';
//ReadFileData.Format("%s",Buff);//这一句我不知道怎么转 nUpType := 165; //0XA5
FillChar(pDowndsBuff[Low(pDowndsBuff)],Length(pDowndsBuff) * SizeOf(pDowndsBuff[Low(pDowndsBuff)]),0);
nDownLen := 14;
ret := PC_Send_To_PCA(nUpType,Buff,nDownLen);//PC_Send_To_PCA函数直接写
Sleep(3000); ptr := pDowndsBuff;
FillChar(appPath[Low(appPath)],Length(appPath) * SizeOf(appPath[Low(appPath)]),0);
Buff[23] := '0';
ptr := Format('%02X %02X',[pDowndsBuff[0],pDowndsBuff[1]]);
{if CompareMem(@pDowndsBuff,'X00X00',2) = 0 then//这里是比较内存地址内容是否正确,我不知道"\x00\x00"这个是它的内存地址还是什么,只能先照抄了
begin end; }
move(pWriteBuff^,mFileBuff^,mWrietLen);//这个是内存拷贝,你这两个都没有定义,所以我也只是先这样写上去
Format('%.2d',[Time.wDay]) + Format('%.2d',[Time.wHour]) +
Format('%.2d',[Time.wMinute]) + Format('%.2d',[Time.wSecond]);
这里没必要用变量
StrPCopy(Buff, Format('%04d %02d %02d %02d %02d %02d', [Time.wYear, Time.wMonth, Time.wDay, Time.wHour, Time.wMinute, Time.wSecond]));