bool StringEqual( const char* p,
const char* tag,
bool ignoreCase
/*TiXmlEncoding encoding */)
{
assert( p );
assert( tag );
if ( !p || !*p )
{
assert( 0 );
return false;
}
const char* q = p;
if ( ignoreCase )
{
while ( *q && *tag && tolower( *q ) == tolower( *tag ) )
{
++q;
++tag;
}
if ( *tag == 0 )
return true;
}
else
{
while ( *q && *tag && *q == *tag )
{
++q;
++tag;
}
if ( *tag == 0 ) // Have we found the end of the tag, and everything equal?
return true;
}
return false;
}
2.读取文件
string line;
ifstream input("input.txt",ios::in);
while(1)
{
getline(input,line);
if(input.eof()) break;
}
input.close();
posted on 2011-12-14 08:11
风轻云淡 阅读(361)
评论(0) 编辑 收藏 引用 所属分类:
C++