When graemef says regular expressions, he means specifically here Perl Compatible Regular Expressions. In C and C++ these can be used from the
pcre library.
I'm not sure the expression he gave covers all legal email addresses, but it does cover quite a lot.
There is a perl module called
Mail::CheckUser, which you should be able to dig though to find out how they do it. I dare say that is quite a robust method.
There is also an
RFC which describes how to to properly validate an email address using pcre's with PHP. You can also have a look at the source for that and see how it should be done. In either case, the only gotcha is that Perl and PHP hove different quoting / escaping rules from literal strings in C/C++, so you'll need some additional/different \ escapes in your regular expressions.
In any case, I highly recommend you do some tutorials on regular expressions in generally, and pcre's in particular - I consider them an essential tool in any competent programmers toolbox. Goodness knows they've saved me hundred of hours writing painful string parsing code myself.