int split(char* sLine, char* fields[], char delimit)
{
int count = 0, index = 0;
fields[count++] = sLine;
while (sLine[index] && sLine[index] != '\r' && sLine[index] != '\n') {
if (sLine[index] == delimit) { // find the delimitor
sLine[index++] = '\0';
if (sLine[index] == delimit)
fields[count++] = NULL;
else
fields[count++] = trim(&sLine[index++]);
}
else
index++;
}
return count; // now sLine was cut into a string array
}
{
int count = 0, index = 0;
fields[count++] = sLine;
while (sLine[index] && sLine[index] != '\r' && sLine[index] != '\n') {
if (sLine[index] == delimit) { // find the delimitor
sLine[index++] = '\0';
if (sLine[index] == delimit)
fields[count++] = NULL;
else
fields[count++] = trim(&sLine[index++]);
}
else
index++;
}
return count; // now sLine was cut into a string array
}