Reading integers from file in c++ -


I currently have a plain text file that has the following three tables:

  0 0 0 0 20 20 0 150 150 150 150 0 0 255 255 255 0 0 255 20 100 100 100 0 100 0 100 100 250 250 255 255 0 0 100 100 0 255 0 20 100 100 100 0 0 0 100 100 20 20 100 0 255 255 255   

Each table displays RGB values ​​for the image. In the first table all red, the second table is all green, the third table is all blue color. I have ARREES red [] [], green [] [] and blue [] [] that I want to store these values.

I currently have a loop:

  string data; Int count = 0; While (gateline (infra, data)) {// iterative though store in data line and array count ++; }   

I definitely know if the count & lt; 5 I should put it in the red array,

Use data string to start a istringstream To remove int s, example:

  while (getline (infile, data)) {std :: istringstream iss (information); Int i, j, k; Continue & gt; & Gt; I & gt; & Gt; J & gt; & Gt; K; Count ++; }    

Comments

Popular posts from this blog

How can I add a seperate action listener to all 14 of my buttons at once that can determine player turn?(java) -

php - Sorting an multidimension array using usort fails -

Simple file compression in C -