overwriting << operator to read a text file.

I have to overwrite the operator>>. The conditions is to take in an numbers and store it into an array until the file contains a ';' from a .txt file.
file ex.
1018929238387; 29323867;
387374848938948747
3837474838734;

I am completely lost and really need help. I have never worked with .txt files and this is my first time overriding the >> operator. I do not know how to work with whitespaces and endlines to skip them from a file.

char ch ;
while( in.get(ch) ) // get the next character
{
// if it is a decimal digit, add the digit to the arrayif( std::isdigit(ch) )
{
int digit = ch - '0' ;
// add digit to array
}
// if it is a ; or a white space, throw it away and end the loopelseif( ch == ';' || std::isspace(ch) ) break ;
else// if it is any other character, there is an arror
{
in.putback(ch) ; // put the character back into the input stream
in.setstate( std::ios_base::failbit ) ; // put the stream in a failed statebreak ; // and end the loop
}
}