I am doing the task about text analyzing. This is console C# app. The programm works with 10 strings. I type strings, press ENTER, read the result on the console. Now I have to analyze 115000 strings from basic input (copy-past to console). When I press PAST it is pasting for 30 secs and thats all. No behavior on ENTER. How I have to work with such a big data in console?
-
1ctrl+v doesn't work in console application. top-left corner Edit | Paste does it work? – faby Sep 03 '14 at 12:48
-
Please read what you wrote and try to find question in it. – Renatas M. Sep 03 '14 at 12:48
-
Take a look to a stream abstraction. It is possible to handle both console and file input in same manner. File is usefull for large input – Valentin P. Sep 03 '14 at 12:53
-
Try store your input in file and then run your console application with `type YourInputFile | YourConsoleApplication.exe`. `type` outputs text of file, `|` redirects output from left part of `|` to right part's input. Will it work or not depends on application though. – Atomosk Sep 03 '14 at 13:18
3 Answers
I think you should do a windows forms app. If you are handling large data, its better to have more control over it

- 2,302
- 2
- 12
- 20
-
What functionality are you losing from a console app to a winforms in his example? – Nahuel Ianni Sep 03 '14 at 12:52
-
If all of your strings are on one line, you are bumping into a limit that Windows has on the number of characters allowed in a command line. Unfortunately, that limit isn't well documented. According to this old article that applies to XP and Server 2003: Command prompt (Cmd. exe) command-line string limitation:
On computers running Microsoft Windows XP or later, the maximum length of the string that you can use at the command prompt is 8191 characters.
However, that article may be obsolete. According to this answer
it seems that the 'arguments' string for a commandline command is limited to 2048 characters in XP and 32768 characters in Win7
What you should do instead of pasting a huge string to the command line for analysis is to is give the name of the file that contains the string(s) in the command line arguments, and use File.ReadAllLines(path)
to read the characters to analyze them.
Update If you task specifies that you absolutely must read this gigantic quantity of string data from the standard input in your console application, you can use command line redirection to actually read it from a file from the command line, i.e.:
ConsoleApplication1.exe < hugefile.txt
I believe this should get around any limits on command line length, though I am not certain.