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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:11:06+00:00 2026-05-29T09:11:06+00:00

The first row of my data file is the headers for the three (or

  • 0

The first row of my data file is the headers for the three (or four) columns of data:

%b02_a08    b02_a08_counts  b02_a08_eu

As you can see, the columns are TAB delimited. When I use getline(), it mashes the whole line together. If I use getline(,,'\t'), it returns %b02_a08 for the line. I need the line separated out, because I read each header.

If anyone knows of a way to read the headers from a data file and put them into a vector<string> so that I can run Regex on them to find the one with “eu” in it, that is all I need to do. Well, that and read the columns of data, which I will probably run into the same TAB delimited problem, 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-05-29T09:11:07+00:00Added an answer on May 29, 2026 at 9:11 am

    Use the stream Luke…

    as in,

    // process the header
    std::getline(some_input_stream, line))
    {
      std::istringstream str(line);
      // Now reaad each field
      str >> header_1 >> header_2 >> header_3;
      if (str >> header_4)
      {
        // process the optional column
        have_col_4 = true;
      }
    }
    
    // Now to read the rows
    while(some_input_stream >> col_1 >> col_2 >> col_3)
    {
      if (have_col_4)
        some_input_stream >> col_4;
    }
    

    The last block can be done with std::getline too (i.e. read a line, construct a stream, then read from the stream), however this tends to be somewhat slower…

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

Sidebar

Related Questions

Currently I have a a text file with data at the first row is
Working on importing a tab-delimited file over HTTP in Python. Before inserting a row's
I want to delete some data displayed in a HTML table row (first on
I can get the the first row in a ListView item in .NET 3.5
How can I take the first row of a cell array that contains doubles
I have a CSV file that has rows, where data for some columns only
I am trying to write data from three txt files in csv file. three
The problem I have a tab delimited input file that looks like so: Variable
I have a file where a data structure containing 6 columns is stored side
The first row is the container for search results to be displayed after user

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.