I am trying to get the address of a certain line in a text file. This line contains the following;
Kmart, 7055 East Broadway, Tucson AZ
I am using strcpy and strtok functions to extract the address (7055 East Broadway), but so far I've only been able to extract the name of the store (Kmart) using my code.
char strLine[] gets the line from the file and I would like to return it to char strAddress[]
How would I extract just the address and possibly the city and state?
#define MAX_CHARS_PER_LINE 80
void getAddress(char strAddress[], const char strLine[])
{
char newLine[MAX_CHARS_PER_LINE+1];
strcpy(newLine,strLine);
char* token = strtok(newLine, ",");
strAddress = token;
printf("%s\n",strAddress);
}