You've got the basic idea but there are a couple of details wrong.
When using 'C' strings, you need to put a null character after the last character in the string. The functions such as atoi() that operate on strings use this to know where the end of the string is. Make your buffer array one element bigger, and write a null character at the end of the string. The easiest way to ensure this is always done is to write the null whenever you append a character.
You have a typo - you used '=' (assignment) instead of '==' (test for equality).
You don't really need to append the ',' to the buffer. It probably won't hurt, but to avoid any doubt test the character before you decide what to do with it.
So that you know what's going on, print out the content of the buffer as well as the value that atoi() gave you from it.
Just to be on the safe side, you should add a check that you aren't adding more characters to the buffer than it has space for.
const int LEN = 4;
char array[LEN+1]; // +1 allows space for the null terminator
int counter = 0;
char c = dataFile.read();
if(c == ',')
if(counter > 0)
value = atoi(array);
counter = 0;
if(counter < LEN)
array[counter++] = c; // append the character
array[counter] = 0; // null-terminate the array
It would probably be a good idea to check for any other characters and not just assume that anything that isn't a comma must be a digit, but if you wrote the file and know it doesn't have any spaces or line feeds or anything else in it then you might decide not to bother.