-1

I have created an ASP.NET Web API which when i run, will display more than 1 million characters. I created a console application which has to display those 1 million characters in the console. However, when i run the console application, only about 4000 characters are shown. Why is that so? Is there a maximum number of characters that a console application can display? What can i do to get all the 1 million characters to be shown in the console application?

Susha Naidu
  • 307
  • 1
  • 3
  • 16
  • 3
    What can you seriously do that is useful with 1M chars in the console? – Zac Faragher Dec 28 '17 at 02:28
  • Send to a file and open the file in a text editor? – Ctznkane525 Dec 28 '17 at 02:29
  • 1
    It is a task given to me to test out if 1 million characters can be generated and received at user end (console application used as user end) – Susha Naidu Dec 28 '17 at 02:34
  • Yes, it's possible. The Windows console will just keep the last part, not the entire output. If you run your compiled exe and add `> filename.txt` at the end, you will redirect all that output to the file, and you will have all your contents there. Not sure what this test is trying to prove though. – Andrew Dec 28 '17 at 02:56
  • Thats right, only the last 4000 characters are shown. I am new to this, can you please explain what does `If you run your compiled exe and add > filename.txt at the end` means? Which is the complied exe you are telling about? – Susha Naidu Dec 28 '17 at 03:01
  • We are only talking about one "compiled exe" here. There is only one and it's your console application. – Nick.Mc Dec 28 '17 at 03:18
  • Where do i add filename.txt to get the whole 1 million characters content to be shown? – Susha Naidu Dec 28 '17 at 03:20
  • 2
    The `>` operator in Command Prompt outputs the results to a file, in this case named `filename.txt`. Running `MyProgram.exe > filename.txt` in Command Prompt will execute `MyProgram.exe` and output the results to a file named `filename.txt` in the same directory – Zac Faragher Dec 28 '17 at 03:27
  • Thank you so much for explaining it to me :) – Susha Naidu Dec 28 '17 at 03:30
  • Possible duplicate of [How to save Console.WriteLine output to text file?](https://stackoverflow.com/questions/4470700/how-to-save-console-writeline-output-to-text-file) – mjwills Dec 28 '17 at 04:51

1 Answers1

1

Try Increase the buffer size of the console window.

Open Command Prompt, Right Click properties on the title bar.

But I also question why this is being done

Lord Darth Vader
  • 1,895
  • 1
  • 17
  • 26