相关疑难解决方法(0)

Apache Thrift,Google Protocol Buffers,MessagePack,ASN.1和Apache Avro之间的主要区别是什么?

所有这些都提供了二进制序列化,RPC框架和IDL.我对它们与特性(性能,易用性,编程语言支持)之间的关键差异感兴趣.

如果您了解任何其他类似技术,请在答案中提及.

thrift asn.1 protocol-buffers avro

121
推荐指数
6
解决办法
3万
查看次数

C ++读取在Python中创建的二进制文件中的地图

我创建了一个 Python 脚本,它创建了以下地图(插图):

map<uint32_t, string> tempMap = {{2,"xx"}, {200, "yy"}};
Run Code Online (Sandbox Code Playgroud)

并将其保存为map.out文件(二进制文件)。当我尝试从 C++ 读取二进制文件时,它不会复制地图,为什么?

    map<uint32_t, string> tempMap;
    ifstream readFile;
    std::streamsize length;

    readFile.open("somePath\\map.out", ios::binary | ios::in);
    if (readFile)
    {
        readFile.ignore( std::numeric_limits<std::streamsize>::max() );
        length = readFile.gcount();
        readFile.clear();   //  Since ignore will have set eof.
        readFile.seekg( 0, std::ios_base::beg );
        readFile.read((char *)&tempMap,length);
        for(auto &it: tempMap)
        {
          /* cout<<("%u, %s",it.first, it.second.c_str()); ->Prints map*/
        }
    }
    readFile.close();
    readFile.clear();
Run Code Online (Sandbox Code Playgroud)

c++ python io file readfile

-3
推荐指数
1
解决办法
397
查看次数

标签 统计

asn.1 ×1

avro ×1

c++ ×1

file ×1

io ×1

protocol-buffers ×1

python ×1

readfile ×1

thrift ×1