Iomanip noskipws

I need to find the number of columns in a txt file like this:

col1 col2
34 12
24 65

This function well work in C++

#include <iostream>
#include <iomanip>
#include <fstream>

int n_colum(char name_file[]) {
   int col = 0;
   char c;
   ifstream f;;
   f >> noskipws; //I have to count the whitespace, tabs, and return
        f >> c;
        if (c==\'t' || c==' ') col++;
    }while(c!='\n'); //I consider the finish of a col when there is a '\n'
   return col+1;

in root the function never stop. thanks.


CINT does not (yet) properly pass noskipws to the stream.
In addition you code is lacking a few extra checks (to avoid the infinite running), you may want to consider to use:

For now, simply compile you script with ACLiC (adding a ‘+’ after your filename).