2008年11月3日 星期一

memory 字元處理


ZeroMemory
char szTime[7]={NULL,};


ZeroMemory(szTime,7);
memcpy( szTime , m_phoneTalk->str_FileTime.Mid(6,2),2);
nDay=atoi(szTime);


ZeroMemory(szTime,7);
sprintf(szTime,"%s%02d",str_Temp.Mid(3,1),Weeks);

----------------------------------------------------------------------
memset


char pResponse[512];
memset(pResponse, 0, sizeof(pResponse));
strcpy(pResponse, "Connect to SMP Failure"); //CString -> char

----------------------------------------------------------------------
memcpy


CString string;
CString Inbuffer[128]; //cut a field
char pTemp[640]; //read a stream to temper


memset(pTemp, 0, sizeof(pTemp));i = 0;

CStdioFile Sfile ((_T("C:\\Test_log\\" + strSN + " data.txt")),CFile::modeRead);


while (Sfile.ReadString (string)) {

memcpy(pTemp,string,640); //CString -> Char

Inbuffer[0]=strtok(pTemp,",");

for(int count=1;count <>Inbuffer[count]=strtok(NULL,",");

i++;

}

Sfile.Close ();

沒有留言:

[c#] process 使用方法

寫法1. Process proc = new Process(); / /PowerShell.exe path proc.StartInfo.FileName = @"c:\Windows\System32\ WindowsPowerShell\v1.0\ powe...