I am using a function to create an array of structures for certain information. I get this error and I'm guessing that the char buf[] variable is the one causing the error.
Is there a way I can convert the buf variable in order for it to be compatible with the strsub function? The last strsub call is the one that is giving me the error.
The salary is a double variable and the buf is a char[].
void strsub(char buf[], char sub[], int start, int end) {
int i, j;
double x;
for (j = 0, i = start; i <= end; i++, j++) {
sub[j] = buf[i];
}
sub[j] = '\0';
while (!feof(fp)) {
fgets(buf, MAX, fp);
strsub(buf, dataArray[i].first, 0, 6);
strsub(buf, dataArray[i].initial, 8, 8);
strsub(buf, dataArray[i].last, 10, 18);
strsub(buf, dataArray[i].street, 20, 35);
strsub(buf, dataArray[i].city, 37, 47);
strsub(buf, dataArray[i].state, 49, 50);
strsub(buf, dataArray[i].zip, 52, 56);
strsub(buf, dataArray[i].age, 58, 59);
strsub(buf, dataArray[i].sex, 61, 61);
strsub(buf, dataArray[i].tenure, 63, 63);
strsub(buf, dataArray[i].salary, 65, 69);
}
}