Click here to Skip to main content
15,886,689 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to save all text from TREEVIEW to TXT file, anyone help..
I made StremWriter , but i don't know how to read all text from treeView?
TNX!
Posted

1 solution

Use Boost library for serialization.
C++
// create and open a character archive for output
    std::ofstream ofs("filename.txt");

    // create class instance
    TreeView *tree = new TreeView();

    // save data to archive
    {
        boost::archive::text_oarchive oa(ofs);
        // write class instance to archive
        oa << tree;
    	// archive and stream closed when destructors are called
    }


http://www.boost.org/doc/libs/1_53_0/libs/serialization/doc/tutorial.html[^]

Pepin z Hane
 
Share this answer
 
v2
Comments
[no name] 21-Apr-13 9:27am    
String^ s;
StreamWriter^ sw = gcnew StreamWriter("view.txt");
sw->WriteLine(treeView1->TopNode->Text);
for(int i=0;i<treeView1->TopNode->Nodes->Count;i++)
{

s = treeView1->Nodes[i]->Nodes->ToString();
sw->WriteLine(s);
}
sw->Flush();
sw->Close();
delete sw;
Can you add code here and post, because i don't know anything about boost library, but i want to learn.. I would be most grateful if you could post all code? TNX!!!!!!!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900