字符串问题,帮忙! 我有字符串char *pbuf='asdhadfsohasodfgaosgdoiuwqeiureuasdasdasd';如何从pbuf左边依次取5位字符 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 CString rrr;rrr=buf;CString kkk;kkk=rrr.Left(5); char strItem[6];strncpy(strItem,pbug,5);strItem[5]='\0'; char newchar;for(int index=0;index<5;index++){ newchar=pbuf[index];} pbuf="asdljapldfjapsdfgaposgjasjgasgjasjgjafjag";我的意思是第一次取‘asdlj’,第二次取‘apldf’,第三次取‘japsd’怎样写个循环 int nCount;int nIndex=0;char strItem[6];nCount=strlen(pbuf);while(nIndex<nCount){ if(nIndex+5<nCount) strncpy(strItem,pbuf,nIndex,5); else strncpy(strItem,pbuf,nIndex,nCount-1); strItem[5]='\0'; nIndex+=5;} 出错strncpy' : function does not take 4 parameters int nCount;int nIndex=0;CString ret;CString kkk;kkk=pbuf;nCount=strlen(pbuf);while(nIndex<nCount){ if(nIndex+5<nCount) ret=kkk.Mid(nIndex,nIndex+5); else ret=kkk.Mid(nIndex,nCount) nIndex+=5;} MFC新建窗口 关于CMap类的应用问题 工作线程中调用SetThreadDesktop失败,请指教? 如何做QQ那样的界面和CJLib里面有一个OutlookBar但效果不好 结构体数组 问个基本的c问题 重定义RAND_MAX的问题 哪里有VC可以下载? zhouwenjie(小周) 进来领分 源代码搜寻 如何是textout输出的字符串透明!? 精典问题,有几种方法可以达到同步?
rrr=buf;
CString kkk;
kkk=rrr.Left(5);
strItem[5]='\0';
for(int index=0;index<5;index++)
{
newchar=pbuf[index];
}
我的意思是第一次取‘asdlj’,第二次取‘apldf’,第三次取‘japsd’怎样写个循环
int nIndex=0;
char strItem[6];
nCount=strlen(pbuf);
while(nIndex<nCount)
{
if(nIndex+5<nCount)
strncpy(strItem,pbuf,nIndex,5); else
strncpy(strItem,pbuf,nIndex,nCount-1);
strItem[5]='\0';
nIndex+=5;
}
strncpy' : function does not take 4 parameters
int nIndex=0;
CString ret;
CString kkk;
kkk=pbuf;
nCount=strlen(pbuf);
while(nIndex<nCount)
{
if(nIndex+5<nCount)
ret=kkk.Mid(nIndex,nIndex+5);
else
ret=kkk.Mid(nIndex,nCount)
nIndex+=5;
}