对于具有空字符的数据,std :: string等效? [英] std::string equivalent for data with null characters?

查看:80
本文介绍了对于具有空字符的数据,std :: string等效?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想读取一个二进制文件,并使用 std :: string 自动调整缓冲区大小等。

I'd like to read a binary file and use something like std::string that automatically resizes the buffer and such.

我使用Visual C ++。我的选项是什么?

I'm using Visual C++. What are my options?

推荐答案

std :: string 这样做...你只需要小心使用 .c_str()方法。使用 .data()

std::string should be safe to do so... you only have to be careful using .c_str() method. Use .data().

这篇关于对于具有空字符的数据,std :: string等效?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆