//2011-03-21
//获取子串根据lp,第一个位置,第二个位置(或者长度也可以)
CString getSubString(LPCTSTR lp, int FirstPos, int SecondPos )
{
if(lp == NULL || SecondPos < FirstPos)
{
return "";
}
if(SecondPos < 0 || FirstPos < 0 )
{
return "";
}
CString strTemp ="";
while(FirstPos < SecondPos)
{
strTemp += *(lp+FirstPos++);
}
return strTemp;
}
struct stu
{
int id;
char name[15];
};
//2011-03-21
//2011-03-21
//在一个字符串中,获取相同字符串的第多少的位置s
int getCharPos(LPCTSTR lp, int loop, char ch)
{
if(loop == 0)
{
return -1;
}
cout << "asdfdfsadfasd" <<endl;
int i = 0;
int pos=0;
while(lp)
{
if(ch == *(lp++))
{
i++;
}
if(i == loop)
{
return pos;
}
pos++;
}
}
//2011-03-21