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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:12:59+00:00 2026-05-31T23:12:59+00:00

i am trying to implement the more command. I want to learn that how

  • 0

i am trying to implement the more command. I want to learn that how can I understand if there is a pipe. For example, if I type from the shell

cat file1 file2 | more

how can I handle that inside the implementation of more?

And is the implementation of more available as open source?

Actually i could not succeed from reading stdin.I’ve managed doing more file.txt but not cat file | more..

i think i should first read from user and put a buffer than print the buffer. my code contains:

if(argc == 1)
{
  fgets(line, 255, 0);
   printf("%s", line);
} 

but it gives error.

  • 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-31T23:13:00+00:00Added an answer on May 31, 2026 at 11:13 pm

    The more syntax is

    more [options] [file_name]
    

    If you don’t provide a file name, the more command gets input from stdin; you can provide this input (via stdin) using a pipe, for example:

    cat file.txt | more
    

    This sends the output of the cat command to more. This is the same as doing:

    more file.txt
    

    You don’t need to specifically know if there is a pipe or not; you just need to check if a filename was passed as argument to more. If so, the input is considered to be the contents of the file. If not, the input is considered to originate from stdin.

    As for the source code, some google searching will take you a long way. Here is some old source code from FreeBSD:

    http://svnweb.freebsd.org/base/stable/2.0.5/usr.bin/more/

    Or more recente source from the Ubuntu repositories:

    http://bazaar.launchpad.net/~vcs-imports/util-linux-ng/trunk/files/head:/text-utils/

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

Sidebar

Related Questions

I'm trying to make an app I'm designing more generic and implement the command
I'm trying to implement a search, where you can enter more than one searchterm
I was trying to implement a sort of shared cache between two or more
Am trying to implement a generic way for reading sections from a config file.
While trying to implement an MVC file upload example on Scott Hanselman's blog. I
when trying to implement an Aspect, that is responsible for catching and logging a
im trying to implement a custom error page, what i want to be able
So I'm trying to implement a more efficient method of calculating 2^n . I
I'm trying to implement a way to animate (translate, fade) controls around (more than
I'm trying to implement a plug-in like application. I know there are already several

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.