限制在C ++中的字符串大小? [英] limit on string size in c++?

查看:74
本文介绍了限制在C ++中的字符串大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我大约有一百万条记录,每个记录大约有30个字符通过套接字插入。我可以将所有内容读入一个字符串中吗?我可以分配的字符串大小有限制吗?

I have like a million records each of about 30 characters coming in over a socket. Can I read all of it into a single string? Is there a limit on the string size I can allocate?

如果有,我是否可以按记录通过套接字记录发送数据并按记录接收记录?我不知道每个记录的大小,直到运行时为止。

If so, is there someway I can send data over the socket records by record and receive it record by record. I dont know the size of each record until runtime.

推荐答案

要回答第一个问题:C ++字符串的最大大小为由 string :: max_size

To answer your first question: The maximum size of a C++ string is given by string::max_size

这篇关于限制在C ++中的字符串大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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