Read from input skipping characters
I have a program that works like this from the command prompt
program < input
the input is a large list of numbers.
i need to read every 3rd number.
at the moment i flick through the whole list like so...
Code:
char c
int number, number1
while (cin >> number1){
number = number + number1;
for(i=0;i<3;i++)
cin >> c
}
how can i skip to the third number (assuming its between 0-9) each time, without having to feed the entire input through a char?
thanks, Karim
thanks for your quick response
i need the program to be as quick as possible, putting the input into an array
wouldn't this mean manipulating the entire input first? which would be slower or the same speed as my current solution i think?
i was thinking more along the lines of extracting data from the input as its stored by the system (input buffer?) i would imagine this would be the fastest solution but i have no idea how to achieve this.
any ideas?
thanks, karim