Help with strcpy and arrays
Hi
Im kinda new to this but here we go...
How is it possible to copy a text string to an array
I got this huge xml file where there are alot of cars.
I want to make an Array which would consist of car names...
Code:
/*Example:
<car>Audi A2 1.4 55 kW</car>
*/
char *separate;
char *car[2000];
char row[2000];
int m=0;
//file opening procedure is also here.. thats not necessary right now.
while(!feof(filename)){
fgets(row, sizeof(row), filename);
separate=strtok(row, "<>/n");
do{
/*So if the separated text string is car, I would like to copy the NEXT seperated text string into an Array... but unfortunately an application error jumps out....
The instruction at "blablabla" referenced memory at"blablabla". The memory coulnd not be "written". Click ok to terminate the program*/
if(!strcmp(separate, "car")){strcpy(car[m],strtok(NULL, "<"));m++} //my bets, mistake is there <<
}while(separate=strtok(NULL, "<>\n"); // < untill the row ends
}
I hope u understood.... if not, tell me... ill try to explain more.