简体   繁体   English

由tesseract创建时File.Exists为false

[英]File.Exists false when created by tesseract

I use tesseract to get text from captcha image. 我使用tesseract从验证码图像获取文本。 I use this code 我用这个代码

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);

The txtSavePath is created in windows explorer, i can open it and can read the text in it. txtSavePath是在Windows资源管理器中创建的,我可以将其打开并读取其中的文本。 But the exist variable is false . 但是现存变量为false It is so strange. 真奇怪 Can anybody tell me why? 谁能告诉我为什么? How can i use StreamReader to read text in created file? 如何使用StreamReader读取创建文件中的文本?

Tesseract appends a ".txt" extension to the output text file; Tesseract将“ .txt”扩展名附加到输出文本文件; so in your case, it should be: 因此,在您的情况下,应为:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM