关于读取配置文件字符串
我要读取这一段的字符串,格式如下
[WebPath]
Value=f:\phfund\
[Threads]
Value=5
我同事用的是这种种方法读取的,请问有比这种方法更好的吗?
if(file.GetLength() != 0)
{
while(file.ReadString(buffer))
{
ipos = buffer.Find(_T("[WebPath]"));
if(ipos >-1)
{
file.ReadString(buffer);
ipos = buffer.Find(_T("Value="));
szWebPath = buffer.Right(buffer.GetLength() - strlen("Value="));
//ipos = -1;
}
ipos = buffer.Find(_T("[Theads]"));
if(ipos>-1)
{
file.ReadString(buffer);
ipos = buffer.Find(_T("Value="));
strUrl = buffer.Right(buffer.GetLength() - strlen("Value="));
}