从文件.Dat加载数据 [英] Load data from file .Dat

查看:85
本文介绍了从文件.Dat加载数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试用C#编写字典,并且使用的数据库是文件.Dat,如何从文件.Dat加载数据.这是文件中1个单词的示例.

例如:

beezer [[''bi:z?]] **//danhtừ``(từlóng)cáimũi

抽屉式[["dr?:ful]] **//danhtừ``mộtngănyy


您需要做的是找到要解释的格式的定义,或者通过观察对格式进行逆向工程(如果格式是文本或带有标题的简单二进制记录,这是一个实用的建议).然后编写一个读取器,以某种格式将其读入内存中的对象,这些对象以一种对您的应用程序有用的方式表示数据.

在这种情况下,格式似乎是制表符分隔的文本,因此您可以使用CSV读取组件或基于字符串的简单读取器将其拆分. br/> 非常感谢


I try to do the dictionary by C#, and use database is file .Dat, How to load data from file .Dat. And this is example for 1 word in file.

EX:

beezer [[''bi:z]]**// danh từ`` (từ lóng) cái mũi

drawerful [[''dr:ful]]**// danh từ`` một ngăn đầy

解决方案

It doesn''t matter what is the file extension.You should know how format of records which are saving then you can retrieve records in reverse.
i.e in simple text format
beeser:meaning of word
drawerful:other meaning
here when i save record i am following this pattern
word + : + meaning
so on reading i have to follow same pattern
now other compact pattern i.e
beezer [[''bi:z]]**// danh từ`` (từ lóng) cái mũi
may be it is using some think like this
word + zip(long meaning of word) etc
which will produce non human readable but you can read in reverse i.e
word + unzip(zipdata)


.dat is a file extension that is used by a lot of different applications to mean a lot of different things. It''s just short for ''data'', and although it usually implies binary data, it is sometimes human-readable text.

What you need to do is either find a definition of the format you are trying to interpret, or reverse-engineer the format by observation (which is a practical proposition if the format is text or simple binary records with headers). Then write a reader that reads that format into in-memory objects that represent the data in a useful way for your application.

In this case the format appears to be tab separated text so you can use a CSV reading component or a simple string based reader to split it up.


so have some example for me :(
Thanks alot


这篇关于从文件.Dat加载数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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