Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

limit on string size in c++?

Tags:

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.

like image 613
aks Avatar asked Sep 06 '10 07:09

aks


People also ask

What is the maximum length of a string in C Mcq?

10) What is the maximum length of a C String.? Explanation: Maximum size of a C String is dependent on implemented PC memory. C does not restrict C array size or String Length.

Is there a limit to string length?

The indexing is done within the maximum range. It means that we cannot store the 2147483648th character. Therefore, the maximum length of String in Java is 0 to 2147483647. So, we can have a String with the length of 2,147,483,647 characters, theoretically.

Is there a string length in C?

The string length in C is equal to the count of all the characters in it (except the null character "\0"). For Example, the string "gfddf" has a length of 5 and the string "4343" has a length of 4.


1 Answers

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

like image 112
Goutham Avatar answered Sep 21 '22 06:09

Goutham