*.hhc文件内容大致是这样,文件路径是szFilePath,文件名是szFileName
语言是C++,平台是visual studio .NET 2003<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=shift_jis">
<meta name="GENERATOR" content="Microsoft&reg; HTML Help Workshop 4.1">
<!-- Sitemap 1.0 -->
</HEAD><BODY>
<UL>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="&lt;&lt;YourApp&gt;&gt; 僿儖僾 僀儞僨僢僋僗">
<param name="Local" value="main_index.htm">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="儊僯儏乕">
</OBJECT>
<UL>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="[僼傽僀儖] 儊僯儏乕偺僐儅儞僪">
<param name="Local" value="menu_file.htm">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="[曇廤] 儊僯儏乕偺僐儅儞僪">
<param name="Local" value="menu_edit.htm">
</OBJECT>
[!if OLEDB || ODBC]
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="[婰榐] 儊僯儏乕偺僐儅儞僪">
<param name="Local" value="menu_record.htm">
</OBJECT>
[!endif]
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="[昞帵] 儊僯儏乕偺僐儅儞僪">
<param name="Local" value="menu_view.htm">
</OBJECT>
[!if APP_TYPE_MDI]
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="[僂傿儞僪僂] 儊僯儏乕偺僐儅儞僪">
<param name="Local" value="menu_window.htm">
</OBJECT>
[!endif]
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="[僿儖僾] 儊僯儏乕偺僐儅儞僪">
<param name="Local" value="menu_help.htm">
</OBJECT>
</UL>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="僗僥乕僞僗 僶乕">
<param name="Local" value="afx_hidw_status_bar.htm">
</OBJECT>
<LI> <OBJECT type="text/sitemap">
<param name="Name" value="僣乕儖 僶乕">
<param name="Local" value="afx_hidw_toolbar.htm">
</OBJECT>
</UL>
</BODY></HTML>************************************************************************************************************现在要实现的是:1,获得里面的<LI> 数目,我是这么写的,但是不确定对不对(本人很菜),能不能用CString::Find之类的函数写。(高手不要吝啬就回个能阿。。)
int i=0; //get topic number
int count=0;
while(szFilePath.Find("<LT>">=0))
{
i=szFilePath.Find("<LT>",i)+1;
count++;
}
int l=sizeof(szFilePath);
char ch;
for(int i=0;i<l;i++)
{
if(strcmp(sizeof(szFilePath),"value"))
ch=szFilePath[i];
}
printf("%c",ch);
***********************************************************************************
2。把每个行<param name="Name" value="&lt;&lt;YourApp&gt;&gt; 僿儖僾 僀儞僨僢僋僗">
中的&lt;&lt;YourApp&gt;&gt; 僿儖僾 僀儞僨僢僋僗  读取出来并且存入数组大致思路是这到这一串<param name="Name" value="然后字符便宜找到">,获取中间的值存到数组(好像很复杂的样子,高分求好心高手)

解决方案 »

  1.   

    你也太菜了 好好练习string操作吧
      

  2.   

    我做的程序:
    转换HHC文件格式为HTM文件格式,把CHM文件的目录显示在IE浏览器上
    编译环境VS2008,其中有你需要的“
    把每个行<param name="Name" value="&lt;&lt;YourApp&gt;&gt; 僿儖僾 僀儞僨僢僋僗">
    中的&lt;&lt;YourApp&gt;&gt; 僿儖僾 僀儞僨僢僋僗 读取出来”
    存入变量local和value;呵呵
    #include "stdafx.h"
    #include <fstream>
    #include <string>
    #include <iostream>
    #include <cstdlib>using namespace std;int _tmain(int argc, _TCHAR* argv[])
    {
        basic_string <char>::size_type index;
        string line, value,local,out="";
        int flag=0,flag2=0,flag3=0,flag4=0;    ifstream infile(L"F:\\Incoming-1\\d\\技术内幕.hhc");
        ofstream outfile(L"F:\\Incoming-1\\d\\o.htm");
    string t="<OBJECT type=\"text/sitemap\">";
      //       <LI> <OBJECT type="text/sitemap">
       //       <LI> <OBJECT type="text/sitemap">
    //    ofstream outfile("out.txt");
        while(!infile.eof())
        {
            getline(infile,line);
    index=line .find(t);
     if (index!= string::npos )//"<LI> <OBJECT type=\"text\/sitemap\">")
              {  flag=1;continue; }         if(flag)
            {
     index=line.find ("</OBJECT>") ;
      if (index!= string::npos )
    {
    if(flag && flag2){flag=0;flag2=0;out+="<li><a href=\"";
    out+=local;out+="\">";out+=value;out+="</a></li>";
    out+="\r\n";}
    if(flag && (!flag2 )){if(!flag3)flag3=1;else out+="</ul>";out+="\r\n"; flag=0;flag2=0;
    out+="<ul>";out+=value;}
    continue; 


        }
         index=line.find ("name=\"Name\"") ;
      if (index!= string::npos )
      
     {
    value=line.substr(line.find("value")+7);  //截取 value=" 后面的string
              value=value.substr(0, value.length()-2);  //去除后面 ">
              //  cout<<value<<endl;  //输出结果,这个结果也可以另外处理,比如写到其他文件
        flag4=1;
    continue; 
    }


              index=line.find ("name=\"Local\"");
        if(flag4 && (index!= string::npos ))
            { flag2=1;flag4=0;
    local=line.substr(line.find("value")+7);  //截取 value=" 后面的string
    local=local.substr(0, local.length()-2);  //去除后面 ">
           ; 
    }
          
             }
      }
    outfile.write(out.c_str (),out.length ());输出文件
    outfile.close();
    infile.close();
      //  system("pause");
        return 0;
    }
      

  3.   

    但是怎么把Local 和Value 的值邦定存到一个数组中呢
      

  4.   

    一周没有上来,在我的程序里面把Local 和Value 的值是string类型
    把他们:Local=Local+Value 很简单的C语言,怀疑你不会C