RT
我把文本文件读到CString里面 然后解析他们例如:cstring str= 半径,45,R,钢筋直径,90.8,D ;
应该有函数可以按逗号把cstring剪切吧?实际的str很长,应该写成循环才行... 多谢高手指点
我把文本文件读到CString里面 然后解析他们例如:cstring str= 半径,45,R,钢筋直径,90.8,D ;
应该有函数可以按逗号把cstring剪切吧?实际的str很长,应该写成循环才行... 多谢高手指点
解决方案 »
- 问一个比较古老的问题,关于账号申请器的
- 我想试着编写一下牌类游戏斗地主的人工智能。
- 怎么获取所有摄像头,并区分其中的USB摄像头
- class ChatClient : public Ice::Application 是什么意思?
- 关于动态库中读取数据库引发的问题
- 求API钩子实例程序
- 关于udp打洞的问题
- 请问如何让编译生成的*.DLL变得小些?
- 调用ExitWindowsEx前是不是要调用AdjustTokenPrivileges, 调用AdjustTokenPrivileges是什么意思 ?
- 控制其他窗口的编辑控件中的内容
- 有没有其它消息代替ON_WM_SHOWWINDOW?我用ClassWizard创建的ON_WM_SHOWWINDOW,就是死活不触发。
- 向BYTE类型的变量中插入数据
int iLoop=0;
iLoop=str.Find(_T(","),1);
半径=str.Left(iLoop);
str=str.Right(str.GetLength()-iLoop-1);
iLoop=str.Find(_T(","),1);
45=str.Left(iLoop);
str=str.Right(str.GetLength()-iLoop-1);
iLoop=str.Find(_T(","),1);
R=str.Left(iLoop);
str=str.Right(str.GetLength()-iLoop-1);
iLoop=str.Find(_T(","),1);
钢筋直径=str.Left(iLoop);
str=str.Right(str.GetLength()-iLoop-1);
iLoop=str.Find(_T(","),1);
90.8=str.Left(iLoop);
D=str.Right(str.GetLength()-iLoop-1);
这样就分离了逗号中的字符
int iLoop=0;
iLoop=str.Find(_T(","),1);
半径=str.Left(iLoop);
str=str.Right(str.GetLength()-iLoop-1);
iLoop=str.Find(_T(","),1);
45=str.Left(iLoop);
str=str.Right(str.GetLength()-iLoop-1);
iLoop=str.Find(_T(","),1);
R=str.Left(iLoop);
str=str.Right(str.GetLength()-iLoop-1);
iLoop=str.Find(_T(","),1);
钢筋直径=str.Left(iLoop);
str=str.Right(str.GetLength()-iLoop-1);
iLoop=str.Find(_T(","),1);
90.8=str.Left(iLoop);
D=str.Right(str.GetLength()-iLoop-1);
这样就分离了逗号中的字符
CString strSingleOne;
for( ;; )
{
const int iComma = str.Find( _T(','), iStart );if( iComma == -1 )
break;strSingleOne= str.Mid( iStart, iComma - iStart );
//strSingleOne: 得到一个由逗号分离的字符串,保存或者做相应处理。iStart = iComma + 1;
}
char* token = _tcstok( s.GetBuffer(0), "," );
while( token != NULL )
{
MessageBox(token);
token = _tcstok( NULL, "," );
}
char* token = _tcstok( s.GetBuffer(0), "," );
while( token != NULL )
{
MessageBox(token);
token = _tcstok( NULL, "," );
}