当前位置: 代码迷 >> QT开发 >> 请问:Qt读取文本数据有关问题!
  详细解决方案

请问:Qt读取文本数据有关问题!

热度:68   发布时间:2016-04-25 04:55:06.0
请教:Qt读取文本数据问题!!!
C/C++ code
Setup Question    = System LanguageToken    =01    // Do NOT change this lineOffset    =00Width    =02Options    =*[00]EnglishSetup Question    = PCI ROM PriorityToken    =05    // Do NOT change this lineOffset    =01Width    =01BIOS Default    =[01]EFI Compatible ROMOptions    =[00]Legacy ROM    // Move "*" to the desired Option         *[01]EFI Compatible ROMSetup Question    = Above 4G DecodingToken    =06    // Do NOT change this lineOffset    =02Width    =01BIOS Default    =[00]DisabledOptions    =*[00]Disabled    // Move "*" to the desired Option         [01]EnabledSetup Question    = PCI Latency TimerToken    =07    // Do NOT change this lineOffset    =03Width    =01BIOS Default    =[20]32 PCI Bus ClocksOptions    =*[20]32 PCI Bus Clocks    // Move "*" to the desired Option         [40]64 PCI Bus Clocks         [60]96 PCI Bus Clocks         [80]128 PCI Bus Clocks         [A0]160 PCI Bus Clocks         [C0]192 PCI Bus Clocks         [E0]224 PCI Bus Clocks         [F8]248 PCI Bus ClocksSetup Question    = VGA Palette SnoopToken    =08    // Do NOT change this lineOffset    =04Width    =01BIOS Default    =[00]DisabledOptions    =*[00]Disabled    // Move "*" to the desired Option         [01]EnabledSetup Question    = PERR# GenerationToken    =09    // Do NOT change this lineOffset    =05Width    =01BIOS Default    =[00]DisabledOptions    =*[00]Disabled    // Move "*" to the desired Option         [01]EnabledSetup Question    = SERR# GenerationToken    =0A    // Do NOT change this lineOffset    =06Width    =01BIOS Default    =[00]DisabledOptions    =*[00]Disabled    // Move "*" to the desired Option         [01]EnabledSetup Question    = Relaxed OrderingToken    =0B    // Do NOT change this lineOffset    =07Width    =01BIOS Default    =[00]DisabledOptions    =*[00]Disabled    // Move "*" to the desired Option         [01]EnabledSetup Question    = Extended TagToken    =0C    // Do NOT change this lineOffset    =08Width    =01BIOS Default    =[00]DisabledOptions    =*[00]Disabled    // Move "*" to the desired Option         [01]Enabled

这样的文本数据,文本格式.txt (125KB ) 文本格式固定,只是OPtions的选择项不固定

如何对以上的数据内容进行数据处理哪??

 例如:快速找到 Setup Question = Extended Tag ,并获取该数据段的内容!!
现在用QFile 读取了所有问题信息,不知道如何快速 处理这些数据。。
真心求教!!!



------解决方案--------------------
如果文件很大,在写文件的时候加个索引
------解决方案--------------------
算法……很简单吧。

我想到了两种方法:
1、逐行读取。跨行的时候用一个变量记录一下。
2、直接上正则表达式。
------解决方案--------------------
如果想带鼠标,Linux 下
cat /dev/fb0 > xxx 把数据取出来,稍剪裁处理为一屏数据,最后转成png。
处理方法很多,搜一下把,dd convert还有现成的c程序,编译成2进制自己调用也行,在代码中添上这段C也行,随你。
  相关解决方案