Search
 
SCRIPT & CODE EXAMPLE
 

CPP

skip headers while reading text

#include<sstream>
...

...
std::ifstream file {"test.txt"};
std::string word, line;
std::istringstream iss;
double var, tab[100][6];
int i=0, j;
...

while(getline(file, line))
{
  if (!(line[0]=='#'))
  {
    iss.str(line);
    
    j = 0;

    while(iss >> var)
    {
      tab[i][j] = var;
      ++j;
    }
    
    iss.clear();

    ++i;
  }
}

file.close();
Comment

PREVIOUS NEXT
Code Example
Cpp :: online c++ graphics compiler 
Cpp :: frac{2}{5}MR^2 typed in c++ 
Cpp :: how to read qlistwidget in c++ 
Cpp :: c++ programming 
Cpp :: how to get the last digit of a number 
Cpp :: 2dvector c++ 
Cpp :: user inptu in cpp 
Cpp :: what is the format specifier for dword c++ 
Cpp :: delete node in a linked list leetcode 
Cpp :: how to make negative number positive in c++ 
Cpp :: FINAL CODES_MY_OS_LAB 
Cpp :: c++ max function 
Cpp :: c++ find string in string 
Cpp :: type casting in cpp 
Cpp :: if statement in c++ 
Cpp :: inpout in Array c++ 
Cpp :: equal elements in two arrays in c++ 
Cpp :: c++ handling 
Cpp :: un aliment traduction espagnol 
C :: reset style matplotlib 
C :: c get time in milliseconds 
C :: adb switch to usb 
C :: sdl draw Rectf 
C :: c loop through binary search tree 
C :: successeur ("123") 
C :: clrscr in c 
C :: what is covert channel 
C :: redirect to url page asp.net mvc 
C :: go optional parameters 
C :: c memset 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =