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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:59:43+00:00 2026-06-01T06:59:43+00:00

How do I read from a file till a particular character is reached and

  • 0

How do I read from a file till a particular character is reached and then seek to the next character and continue reading in C++.

In my program I am using some HTML syntax and generating a .htm file… So in my C++ code I have added the tags.

But when I read from my .htm file I want it to not include the tags.

What I plan on doing is reading the file till '<' is encountered then just seek to the point till '>' is encountered and continue reading from there.

  • 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-01T06:59:44+00:00Added an answer on June 1, 2026 at 6:59 am

    First of all, you should be aware that doing this correctly is quite a bit trickier than you apparently think.

    Just answering the question as you asked it, you can use istream::get to read a character at a time until you get a ‘<‘. You can use ignore to ignore characters up to the next ‘>’ in the stream.

    Getting back to the first point, however, that generally won’t work correctly. In particular, it’s entirely possible for a tag to contain a string, and the string (in turn) contain a ‘>’ that is not the close of the tag. As such, to have any hope of parsing the HTML correctly, you need to parse for strings inside the tags, and when you find them, skip across their contents rather than treating any ‘>’ they might contain as ending the tag.

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

Sidebar

Related Questions

The string in question (read from a file): if (true) then { _this =
I am trying to read from a file on the local machine using Ajax.The
I'm using fopen to read from a file $fh = fopen($path, 'r') or die('Could
I am using fgets() to read lines from file. I am able to read
I am writing to file in android and read from the same file using
I am new at java. I am doing the following: Read from file, then
Till now I had been using following code to ftp file from one location
I've got a function that should read from file line by line, the reading
This program want to read from a file. the content in the file is
I want to read 8byte chunks from a binary file at a time till

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.