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

  • Home
  • SEARCH
  • 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 8897669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T00:24:22+00:00 2026-06-15T00:24:22+00:00

For an exercise about termcaps, I have to write a program that will display

  • 0

For an exercise about termcaps, I have to write a program that will display a list of items and let the user to select some of them. The program will then output the selected items separated with a space. The program can be called like this:

$> ./my_program foo1 foo2 foo3

or like this:

$> ls `my_program foo1 foo2 foo3`

My program works well in the first case, but in the second case, the stdout of my_program is intercepted by the backticks and will not show up on the terminal. I know that the program is running well since I got the expected result from ls if I select some items blindly.

In my program, I can’t use any built-in functions excepted the following:
• ioctl
• tcsetattr
• tcgetattr
• tgetent
• tgoto
• tputs
• tgetstr
• tparm
• open
• close
• write
• malloc
• free
• read
• exit
• signal

How can I display my_program’s stdout to the user when called like in the second case ?

EDIT:
The only option I found is to output everything to stderr and output the selected items to stdout…

  • 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-15T00:24:23+00:00Added an answer on June 15, 2026 at 12:24 am

    You can open and write to /dev/tty in my_program and it will be only to the terminal not to the redirected stdout.

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

Sidebar

Related Questions

For about a year I have been thinking about writing a program that writes
I have a C program for an exercise and it has a strange issue
I'm currently learning about structs, so I have the following exercise: Set a Struct
I learning to use Pointers. I have a few questions about an exercise code
I have been given an exercise about anagrams and it looked so really easy
I have a few questions about this function from John Resig's exercise #19 in
I`m doing some exercise on XV6 that is mini OS for education. I want
I'm working through Udacity and Dave Evans introduced an exercise about list properties list1
I have a question about map and delegate. I am doing a exercise from
I'm trying to teach myself C++, and I'm going through a basic exercise about

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.