C String Length Maximization

I want to input a string in C which can be of length 10^6.
But I can take strings of only up to 4095 characters.
Can I increase the limit up to my requirements?
Or it can be done with the concatenation of multiple strings.

Why? Please post your code; what platform/ compiler you’re using; what testcase you’re using; etc.

3 Likes

Thanks for Your Quick response.
I found the solution.

Solution :
Changing the input mode of the gcc compiler in C to Non-Canonical Mode from Canonical Mode.
It includes removing the ICANON flag of terminos c_lflag.

struct terminos tattr;
tattr.c_lflag &= ~(ICANON);

The mode can be changed back to Canonical by:

tattr.c_lflag |= ICANON;