CString 转 char 数组有关问题

CString 转 char 数组问题
CString sTime;
sTime="yshjel"
char date[9];
strncpy(date,(LPCTSTR)sTime,sizeof(date));


请问为什么date[9]数组里面什么也没有????
在线等,请帮忙

------解决方案--------------------
strncpy(date,sTime,sTime.GetLength());
试试

------解决方案--------------------
The strncpy function copies the initial count characters of strSource to strDest and returns strDest. If count is less than or equal to the length of strSource, a null character is not appended automatically to the copied string. If count is greater than the length of strSource, the destination string is padded with null characters up to length count. The behavior of strncpy is undefined if the source and destination strings overlap.


------解决方案--------------------
strncpy(date,(LPCTSTR)sTime.GetBuffer(0),sizeof(date));

------解决方案--------------------
探讨

strncpy(date,sTime,sTime.GetLength());
试试

------解决方案--------------------
CString sTime;
sTime="yshjel"
char date[9];
sprintf(date,"%s",LPCTSTR(sTime));