Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8052531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:34:01+00:00 2026-06-05T07:34:01+00:00

I have a simple C console application and I’m trying to test it with

  • 0

I have a simple C console application and I’m trying to test it with an input of 100,000. But the program only receives about 4,096 characters each time. This is a simple example of input:

1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1    //Up to 100,000

It works if I manually write a number each time, but I want to just paste the input(100,000 space-separated numbers) into the console.

PS: Sorry for my English, it’s not very good

EDIT: Yes, the platform I’m using is Windows cmd. And I have already tried “Properties>Options>Buffer Size”.

Example of the code:

int a[100000],i;
for(i=0;i<100000;i++)
    scanf("%i",&a[i]);

Print screen of the test:
enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T07:34:02+00:00Added an answer on June 5, 2026 at 7:34 am

    The standard IO routines (such as printf() and scanf()) use buffering to improve performance and provide some nice standardized routines (such as fgets() to read in a line at a time). Making function calls is usually significantly faster than making system calls; if you were to write an application using system calls to read one byte of data at a time it would run significantly slower than an application that reads 1024 bytes at a time or larger.

    This is almost always a wonderful thing.

    But it does mean that you need to write your applications carefully. You cannot simply issue a single read()-style function that will read all the data at once. (The amount of available data may be significantly greater than the amount of memory and swap space available on the machine, too, so even if you could, it would not be very reliable in all use cases.)

    Applications that handle a stream of input tend to have a loop something like these:

    int c;
    while ((c = getc()) != EOF) {
        /* handle the character c */
    }
    

    or

    char buffer[1024];
    while (fgets(buffer, sizeof buffer, F)) {
        /* handle buffer */
    }
    

    The first case is convenient because you never need to worry about input that’s been broken across two or more “buffers” — but the first case does mean sscanf() and similar tools can’t help you parse numbers. The second case does allow you to use sscanf() when parsing, but you have to be prepared for an input to span across two buffers. This is easier to spot if the buffer is only eight bytes: buffer[8] and you wish to read in a 32-byte MD5sum or a double that requires more than eight characters to express: 1234567890. The first read will get the first eight bytes, the second read will get the next two bytes, and you’ll have to construct your number.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple Java console application and would like to test its input
I have a simple test application (C# console application) that does an HTTP GET
I am writing a simple console application in Objective-C but I have heard that
I have a simple c# console application but i am getting wrong output why?
I have a simple C# Console application in which I use FileSystemWatcher and Moving
i have a simple .EXE console application, written in C# via Visual Studio 2008.
I have written very very simple console application which supports some command line options.
So I am trying to run console 64 bit Hello World program. I have
I have a simple console application where I have the following setup: public interface
I have a very simple console application that creates a text file. Below is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.