I have a problem with converting string to int, need to save a 5 digit number in each std::list element. I use this:

```
for(int i =0; i< e.length(); ++i)
{
    tmp = tmp*10+ e[i] - '0';
    ++rads;
    if(rads>4) 
    {
       numbs.push_back(tmp);
       rads=0;
       tmp=0;
    }
}

```

If in input number is: 

> 
> 10000 00012 02345 00001 
> 
> 
> 

in list I will get:

> 
> 10000 12 2345 1 
> 
> 
> 

All the problem is to save without loosing zeros after 

> 
> rads>4 or rads==Rads
> 
> 
> 

What I also tried:

> 
> To save as base #define-d Rads
> 
> 
> 

```
for(int i =0; i< e.length(); ++i)
{
    tmp = tmp*10+ e[i] - '0';
    if(tmp>=Rads) // Rads defined as 10000
    {
       cumul = cumul*10+tmp/Rads;
       tmp = tmp%Rads;
    }
   if(cumul>=Rads) // Rads defined as 10000
    {
       numbs.push_back(cumul);
       cumul = 0;
    }

}

```

I've read and looked into various sources codes and articles related to this, in none of them there was suitable solution (not code, but idea at least) or solution was to save as int/char [by one digit]. By one is the easiest way, but it will be too expensive to process one int with only 2^4 bits occupied. That's why I am looking for the way to save 5 digit integer in x32 word, so it could be possible to fit working time limits and avoid rewriting of already realized code for "+ - / \* %"
In search more or less close question posted close to mine was [How to split big numbers?](https://stackoverflow.com/questions/2394698/how-to-split-big-numbers/2394788#2394788)