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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T18:54:12+00:00 2026-06-14T18:54:12+00:00

I want to read from a file by using its file descriptor. I can’t

  • 0

I want to read from a file by using its file descriptor. I can’t use its name because of assignment rules.

I obtain it by calling open and it works fine. At this moment I know that I have to use the read() function in order to read from it. My problem is that read() function requires as an argument the number of bytes to read, and I want to read a whole line from the file each time, so I don’t know how many bytes to read.

If i use for example fscanf(), it works fine with a simple string and I take back the whole line as I want. So my question is:

Is there any function like fscanf() which can be called with file descriptor and not with a file pointer?

  • 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-14T18:54:13+00:00Added an answer on June 14, 2026 at 6:54 pm

    When you say “have to use read()” I can’t tell if that’s your understanding of the situation given a file descriptor from open() or a restriction on some kind of assignment.

    If you have a file descriptor but you’re more comfortable with fscanf() and friends, use fdopen() to get a FILE * from your fd and proceed to use stdio.

    Internally it uses functions like read() into a buffer and then processes those buffers as you read them with fscanf() and friends.

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

Sidebar

Related Questions

I want to read lines from a file into a Set or List. Is
i want to read from a text file in C#. But I want all
I want to ask, what is recommended way to read from file, AAsset_read or
I want to read a file from a java web application. I don't want
I want to read actionmessages from the property file in struts2 and at the
In my grails application I want to read some values from properties file and
I want to read a INI file from python, and I came up with
I want to read the pdf file from raw folder if devices have any
I want to read an .xml file from a web radio for my app.
I have Uitable with data read from a AScii file. I want to select

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.