I am reading some numbers. The input is for example:
1 2 3 4 ; 2 3 4 5 6;
When I read ';' I want to do something with it and the number up to it. Currently, I am using:
while(1) {
    cin >> num;
    if(cin.fail()){
        // end of first array
        return 0;
    }
}
However, this way cin may fail if it is any char, not just ';'
 
    