MFC测试文件打开并将其显示为树 [英] MFC Test File Open and Display it as tree

查看:84
本文介绍了MFC测试文件打开并将其显示为树的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含跟随数据的文本文件

A-A1



其中A是根,A1是孩子。

我需要创建一个MFC SDI应用程序来打开txt文件并以这样的树格式打印内容

A

| _ A1



由于我是新手,我真的不知道从哪里开始如何在我的应用程序中打开文件如何解析数据等。

感谢任何帮助。

提前谢谢。

I have a text file with the follownd data
A-A1

In which A is the root and A1 is the child.
I need to create an MFC SDI Application to open the txt file and print the contents in the tree format like this
A
|_ A1

Since im a newbie in this i really dont know where to start like how to open a file in my application how to parse the data etc.
Any help is appreciated.
Thanks in advance.

推荐答案

解析数据只是分割文本的问题通过解析器进入其组成部分。您可以根据许多tokenizer函数之一编写自己的,也可以实现免费的第三方解析器。创建树同样不太困难,因为Windows有一个内置树控件,在MFC中实现为 CTreeView [ ^ ]。周围还有很多样本项目可以帮助我们掌握基础知识;看看文章部分 [ ^ ]。
Parsing the data is simply a matter of splitting your text into its constituent parts via a parser. You can either write your own, based on one of the many tokenizer functions, or you can implement a free third party parser. Creating the tree is similarly not too difficult as Windows has a built in tree control that is implemnted in MFC as the CTreeView Class[^]. There are also many sample projects around that can help with the basics; take a look at the articles section[^].


因为我已经用Visual Studio开始了两天...我真的不知道解析如何工作以及在哪个函数中实现这些函数,因为当我以new的名义创建一个简单的SDI应用程序时,有许多源文件..:(
Since i have started jus two days back with Visual Studio .. i really dont know how that parsing works and where in and under in which function these are to be implemented because when i create a simple SDI application in the name of "new" there are many source files .. :(


这篇关于MFC测试文件打开并将其显示为树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆