【问题标题】:File.Exists false when created by tesseractFile.Exists 由 tesseract 创建时为 false
【发布时间】:2016-04-28 14:19:48
【问题描述】:

我使用 tesseract 从验证码图像中获取文本。 我用这个代码

Process p = new Process();
p.StartInfo.FileName = Server.MapPath("~/app/tesseract.exe");
p.StartInfo.Arguments = imgSavePath + " " + txtSavePath;
p.Start();
p.WaitForExit();
bool exist = File.Exists(txtSavePath);

txtSavePath 是在 windows 资源管理器中创建的,我可以打开它并阅读其中的文本。但是 exist 变量是 false。太奇怪了。 谁能告诉我为什么?如何使用 StreamReader 读取创建文件中的文本?

【问题讨论】:

    标签: c# captcha tesseract


    【解决方案1】:

    Tesseract 将“.txt”扩展名附加到输出文本文件;所以在你的情况下,它应该是:

    bool exist = File.Exists(txtSavePath + ".txt");
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-09-21
      • 1970-01-01
      • 2015-05-05
      • 1970-01-01
      • 2010-10-29
      • 2016-04-29
      • 1970-01-01
      相关资源
      最近更新 更多