I have data that is coming into my buffer via popen (process data, not a file). Every seven records is a new set [0-6]. I am trying to 'print out the array line/element value' and 'change the value of element [2] to 0', but my loop appears to be looping through every character and not just every line?
value 1: 1
value 2: 9
value 1: 2
value 2: 0
value 1: B
value 2: u
Found String!
value 1: 0
value 2: .
value 1: 1
value 2: 9
value 1: 1
value 2: 9
value 1: 0
value 2: .
value 1: 1
value 2: 9
value 1: 2
value 2: 0
value 1: B
value 2: u
Found String!
value 1: 0
value 2: .
value 1: 0
value 2: .
value 1: 0
value 2: .
value 1: 0
value 2: .
value 1: 1
value 2: 9
value 1: 2
value 2: 0
value 1: B
value 2: u
Found String!
value 1: 0
value 2: .
value 1: 0
value 2: .
value 1: 0
value 2: .
value 1: 0
value 2: .
value 1: 1
value 2: 9
value 1: 2
value 2: 0
value 1: B
value 2: u
Found String!
value 1: 0
value 2: .
value 1: 0
value 2: .
value 1: 0
value 2: .
value 1: 0
value 2: .
expected output:
199729173
2014-11-16 10:09:34
Found String!
198397652
2014-11-14 15:10:10
Found String!
198397685
2014-11-14 15:10:13
Found String!
198398295
2014-11-14 15:11:14
Found String!
Each time through the outer loop you:
- read a line into buff
- point cstr2 to buff. So now it points to the line also.
Then in the inner loop you
- first time through the loop you print the first character in the line
- second time you print the second character in the line
- third time you check if the line is "Buy"