Possible Duplicate:
Console.Readline() max length?
In my attempt to find a very simple text to speech application I decided it was faster to write my own. I noticed, however, that Console.Readline()
is limited in the amount of text it allows per line to 254 characters; I can't find anything about this limit in the method documentation.
Is this a limitation in the Windows stack, or a problem with my code? How can I overcome it? I could decide to read character by character with Console.Readkey()
, but won't I then risk losing characters to the MS DOS dumb text pasting behavior?
A quick look at implementation with .NET Reflector gives this:
256 is the default value of OpenStandardInput, so I guess it's by design. Note this is only for .NET as the Windows API does not have this limit.
This is a somewhat bizarre limitation on the Console API. I had this problem before and found the followig solutions:
From the following MSDN forum post:
http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/51ad87c5-92a3-4bb3-8385-bf66a48d6953
See also this related StackOverflow question:
Console.ReadLine() max length?