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 7432215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:25:25+00:00 2026-05-29T09:25:25+00:00

I am creating a Linux terminal program using C. I am trying to make

  • 0

I am creating a Linux terminal program using C.

I am trying to make a two digit code address a array location.
I don’t want to have to hit enter after every two digit input, I want the input to just be sent to my buffer variable through scanf directly after to characters are entered.

I do not have a code sample, as i have no idea how to approach this.

Thanks for any help!

  • 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-05-29T09:25:26+00:00Added an answer on May 29, 2026 at 9:25 am

    You’ve got two options, which solve the same problem in nearly the same way. The first is to use stdbuf when you run your program; the invocation is:

     stdbuf -i0 ./a.out
    

    Using that prevents stdin from being line-buffered, and will let you use fread() or similar commands to retrieve input as it happens.

    The other is to put the terminal in raw mode. It’s well-described here. But the downside is that control characters are no longer dealt with. In your program, you

    #include <termios.h> 
    
    main(){
        struct termios trm;
    
        tcgetattr(STDIN_FILENO, &trm); /* get the current settings */
        trm.c_cc[VMIN] = 1;     /* return after 1 byte read; you might make this a 2*/
        trm.c_cc[VTIME] = 0;    /* block forever until 1 byte is read */
        tcsetattr(STDIN_FILENO, TCSANOW, &trm); 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im using linux with gedit which has the wonderful habit of creating a temp
I'm creating a Linux tgz self-extracting installer using CPack and I'd like the installer
I'm creating a linux program in C++ for a portable device in order to
I want to install and use java on a linux server. specifically, for creating
I'm trying to analyze a Linux kernel panic on openSUSE 11.3 using kdump and
I want to start creating some 3D software for Linux, and heard that OpenGL
Somebody knows a nice program for creating database models supporting Osx and Linux? If
I am creating new virtual device using ubuntu gelelio@ubuntu:/media/Android/eclipse-linux/android-sdk-linux_x86/tools$ ./android I have create new
I want to write GUI aplication for creating linux users in pyGTK. In linux
I'm creating a multi-threaded application in C using Linux. I'm unsure whether I should

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.