<p>I have the following character string: </p>

<pre><code>"..1....10..20....30...40....50...80..." 
</code></pre>

<p>and I need to extract all numbers from it into array. </p>

<p>What is the best way to do it in C? </p>

Perhaps the easiest way is to use the
```
strtok()
```
function (or
```
strtok_r()
```
if reentrancy is a concern):
```
```
char str[] = "..1...10...20";
char *p = strtok(str, ".");
while (p != NULL) {
    printf("%d\n", atoi(p));
    p = strtok(NULL, ".");
}
```
```
Once you have the results of calling
```
atoi()
```
, it should be a simple matter to save those integers into an array.