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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:36:51+00:00 2026-05-23T12:36:51+00:00

I have an xml like file and I have to read only a part

  • 0

I have an xml like file and I have to read only a part of the file.(subfile).
Then I have to search this subfile for some “strings”.

I thought of reading a file from a start pointer till an end pointer(which would be the subfile). Then I should work with this subfile and inspect line by line of the subfile using fgets().

The trouble is, fgets seems to take only a file pointer as parameter 🙁
Any ideas??

  • 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-23T12:36:52+00:00Added an answer on May 23, 2026 at 12:36 pm

    You can use mmap() on UNIX/Linux to map a file to memory. This should make it easier to isolate a part of the file and work with it. Your xml library will probably want a buffer if it parses raw data, so you can just pass it the mmap result.

    Here is an excellent example of usage

    http://www.cs.purdue.edu/homes/fahmy/cs503/mmap.txt

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

Sidebar

Related Questions

I have an xml file like this: <result> <customer> <id>1</id> <name>A</name> </customer> <customer> <id>2</id>
I have an XML file like this: <SiteConfig> <Sites> <Site Identifier=a /> <Site Identifier=b
I have an XML file looks like this: <?xml version=1.0 encoding=utf-8 ?> <PathMasks> <Mask
I have an options_menu.xml file like this: <?xml version=1.0 encoding=utf-8?> <menu xmlns:android=http://schemas.android.com/apk/res/android> <item android:id=@+id/search
I have an XML file that I would like to map some attributes of
I have a XML file like this: <Document> <Tests> <Test> <Name>A</Name> <Value>1</Value> </Test> <Test>
Hi All I have a xml file like <Amt><InstdAmt Ccy=ABCD>1200.00</InstdAmt><EqvtAmt><Amt/><CcyOfTrf/></EqvtAmt></Amt> how will read value
i have a exrate.xml look like this <!--For reference only. Only one request every
I have some xml that looks like this: <rootElement attribute=' > '/> This is
I have an xml file stored on my website that looks like this: <games>

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.