gobartatti - As we all can see, you are new to our community. One way of getting you noticed in a good way, and also, to be helped, is to obey the rules (which you agreed upon your registration) and not to embarrass yourself by your posts.
I see you have a question, but this thread in which you posted is 6 years old (threads older than 3 months shouldn't be replied, only if adding important/new information to the topic). I sugest you to start a new topic in wich to exaplain your needs/problems, also proving (by showing some code) that you'd tried to solve that issues.
Instead of atoi, use strtol() (string to long) or strtoll() (string to long long). They let you provide a pointer that will be set to the first unconvertable character. It will deal with +- leaders, and all the rest of that cruft. Perfectly fine in C++. If you are reading from a stream in C++, then you are probably better off using the syntax strm >> intvar such as cin >> anInt.