使用dll后禁用C#文件ReadAllLine函数无限等待

问题描述

我的程序的运行顺序是(通过dll调用创建文件->读取创建的文件

但它不起作用。

调用dll后,ReadAllLine函数不起作用,进入无限等待状态。 使用的cpu也是0。

如何运行函数并读取文件

[DllImport("Pcap_Parsing.dll",EntryPoint = "DEC_Parsing",ExactSpelling = true,CallingConvention = CallingConvention.Cdecl)]

string FilePath = "file~~~/~~~/~~~.pcap"
string[] FileLines;

public static extern void DEC_Parsing(string fn);

Parsing(FilePath); //file create test.ini
FileLines = System.IO.File.ReadAllLines(~~~~path/test.ini); //When this function is executed,the cpu usage becomes 0 and it is in an infinite wait state. 

解决方法

pcap 文件不是文本文件,我认为很难使用将行读取到 string[] 的方法。试试这个而不解析它可能会工作,因为设备上保存的所有文件都是二进制文件。

0x05