c++ - FileStore::OpenErr 在内存位置 0x012FED64

标签 c++ visual-studio visual-studio-2017 crypto++

我正在使用 Crypto++ 库对文件进行哈希处理。我在内存位置 0x012FED64 处收到错误 FileStore::OpenErr:

FileSource file(filename.c_str(), false, new HexEncoder(new StringSink(result)));

代码是:

#include <iostream>
#include "..\cryptopp\sha.h"
#include "..\cryptopp\hex.h"
#include "..\cryptopp\files.h"
using namespace std;

string hashFile(string filename);

int main() {
    string shahash("");
    string fileName = "D:\test.txt";
    shahash = hashFile(fileName);
    cout << shahash << endl;
    return 0;
}

string hashFile(string filename)
{
    string result;
    SHA256 hash;
    FileSource file(filename.c_str(), false, new HexEncoder(new StringSink(result)));

    file.PumpAll();
    return result;
}

详细错误如下:

Exception thrown at 0x764B08B2 in myproject.exe: Microsoft C++ exception: CryptoPP::FileStore::OpenErr at memory location 0x012FED64.
Unhandled exception at 0x764B08B2 in myproject.exe: Microsoft C++ exception: CryptoPP::FileStore::OpenErr at memory location 0x012FED64.

The program '[13128] myproject.exe' has exited with code 0 (0x0).

描述错误的屏幕截图是:

enter image description here

这种错误的可能原因是什么?

谢谢。

最佳答案

string fileName = "D:\test.txt";

应该是

string fileName = "D:\\test.txt";

\t 是制表符。我很确定您不希望在您的文件名中使用它。

关于c++ - FileStore::OpenErr 在内存位置 0x012FED64,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48420744/

相关文章:

c# - Visual Studio : Replace all references to ConfigurationManager. AppSettings 到 CloudConfigurationManager.GetSetting 使用正则表达式

c# - 仅在 Visual Studio Code 中出现编译错误

c# - Visual Studio 2017 中的 Microsoft Rdlc 报表设计器

entity-framework - Visual Studio 无法加载 Entity Framework PowerShell 脚本,因为其操作被软件限制策略阻止

c++ - 编译时检查变量是否有符号/无符号

c++ - 使用tesseract 3.01的页面布局分析出现的奇怪问题

c++ 释放器在转换后丢失了吗?

python - tensorflow 模型 : How to identify input/output nodes name from a proto buff file?

c++ - 编译支持 MySQL 的 QuickFIX C++

c# - 如何将自定义流程模板添加到 TFS 2013?