void write_to_array(string s,int a[][NUM],int i){
vector<string> vec;
int position=s.find(":"); //no checking for success
string temp;
for (int p=position+1; p<s.size(); p++) {
if(s[p]==' '){
temp.clear();
int f=1;
while (s[p+f]!=' ') { //possible out of bounds
f++;
}
temp=s.substr(p+2,f); //nonsense.
vec.push_back(temp);
}
}
for (int m=0; m<200 ; m++) {
a[i][m]=atoi(vec[m].c_str()); //¿how do you know the size of the vector? Also, ¿why don't just pass the row to work with?
}
}
About the nonsense part.
`s[p]' has an space, you don't know anything about `s[p+2]', which may be out of bounds.
`f' seems to be counting the number of spaces, but it is used as the number of characters to extract.
`p' just increases in 1, giving overlaping substrings.
All this for ending converting an string to a number, don't understand why don't you read the numbers in the first place.