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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:36:38+00:00 2026-05-19T22:36:38+00:00

I want to parse a text file to get what I want and create

  • 0

I want to parse a text file to get what I want and create another txt file in c++.
I have a text file which looks something like this.

User :

Group : 

Comment1 :

Comment2 :

*** Label ***

ID : Nick

PASS : sky123

Number ID : 9402

*** End of Label ***

######################################

And goes on.
I basically want to create a new txt file which leaves all lines which contains colon(:) and erase the rest such as “* Label *“, and save the result in a new txt file.
The answer to that txt file would be

User :

Group :

Comment1 :

Comment2 :

ID : Nick

PASS : sky123

Number ID : 9402

How do I do this in a simple way?
Thank you very much.

  • 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-19T22:36:39+00:00Added an answer on May 19, 2026 at 10:36 pm

    I have not tested this, but you get the idea.

    void foo(ifstream& ifs, ofstream& ofs)
    {
        while ( !ifs.eof() )
        {
            string line;
            getline(ifs, line);
            if (line.find(":") != string::npos)
                ofs << line;
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

can i please get some guidance to constructing a parser for an input file,
I need help to parse some information from a mass of text, basically I
I have a question regarding inheritance, so I will describe the scenario below: I
In my aplication i want to send a html template to the users email.
My goal is to create an personal application out of my ActionScript3 video player.
at the moment I am a bit confused. I receive an XML file and
So when I decided to parse content from a website. For example, http://allrecipes.com/Recipe/Slow-Cooker-Pork-Chops-II/Detail.aspx I
I want to run a sqlldr command customized with some parameters, more precisely a
I am having an issue with creating an XLSX document with the Open XML
Hey everybody, I am writing a program that compares the running times of various

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.