Re: Standard Input Max Length Limitation
- Posted by Fernando Bauer <fmbauer at hotmail.com> Jun 27, 2007
- 735 views
Matt Lewis wrote: > > Robert Craig wrote: > > > > Pete Lomax wrote: > > > Matt Lewis wrote: > > > > Is there a particular reason why you want to run under DOS instead of > > > > windows? You can use exwc.exe, which is the console version of the > > > > interpreter for windows. > > > I thought about that but a test showed it limited input to 79 characters! > > > > I'm not sure why that is, but there's no magic number built into > > Euphoria itself that limits gets(0). It will happily malloc > > space for millions of characters. > > Yep, and it works as expected if you pipe stdio instead of typing it. > > > If I open a command-prompt window with XP, > > and hold down the 'x' key, it complains that > > "'xxxxxxxxxxxxxxxxxxxxxxxxxxxxx' is not recognized as an internal > > or external command, operable program or batch file" > > > > But when I reach 259 x-characters it changes the complaint to: > > "The input line is too long." > > > > Note, I'm not running a Euphoria program at all, > > just entering a command at the prompt. > > Yeah, I'm that's a limitation of cmd.exe, but I was surprised to find that > I could only get 79 characters typed into the console when I run this code: > }}} <eucode> > ? length( gets(0) & 0 ) - 1 > </eucode> {{{ > I suspect that it's something to do with the console buffer not wanting to > do a line wrap, but I haven't dug deep enough to figure out if that's true. > > I haven't tried at all with linux. > > Matt Hi, If you run for DOS (ex.exe) it results 128 in my system (WinXP). If I am right, the result obtained (79) in case of Windows is related to the position, not to the quantity of characters. Try this: position(1,70) ? length( gets(0) & 0 ) - 1 In file be_runtime.c we can read in the function key_gets() (from line 4529 of version 3.0.2): if (column < 79) { len = strlen(input_string); one_char[0] = c; ... This function is called by wingetch() which is called by EGets(). If the exw.exe is compiled with BORLAND or LCC, probably the result will be different, because key_gets() isn't called. Maybe Rob could better explain that limit for Windows? Regards, Fernando Porto Alegre/RS Brazil