樹的枝是對應一字符串﹐葉對應一個結構體對象﹐數據量不大﹐不知道用什么方法保存和讀取好點﹐是用數據庫或自己定義格式存儲?具體怎么實現﹐望詳細指點

解决方案 »

  1.   

    http://www.codeguru.com/Cpp/controls/treeview/misc-advanced/article.php/c713/现成的例子
    Serializing to / from a text file
      

  2.   

    struct
    {
       int lastlevel ; //上一级编号
       int level ; //编号。唯一的
       int nextleve ; //有必要的话,添加下一级编号
       char name[xx] ; //名称
       ....
    }
    这样可以放到数据库中
      

  3.   

    我建议用类:
    class CNode
    {
    …………
    protected:
    /// 节点名称
    string m_strName;
    /// 节点ID
    unsigned long m_ulID;
    /// 节点类型
    unsigned long m_ulType;
    /// 节点版本
    unsigned long m_ulVersion; /// 父节点ID
    unsigned long m_ulParentID;
    /// 父节点类型
    unsigned long m_ulParentType;
    /// 子节点列表
    CNodeList m_childs; /// 节点外部表现类
    ………………
    }