I am having an issue reading in a file with a certain format using strtok. Each line in the file contains a format as shown below:
Bill Simpson, 01452356
When I display only temp_id
I get (Underscore = whitespace):
"_01452356"
The code for breaking apart each line is as follows:
while((fgets(temp_string, LENGTH, ifp))!= NULL)
{
temp_name = strtok(temp_string, comma);
temp_id = strtok(NULL, comma);
add(temp_name, temp_id);
}
I simply want temp_id
to not contain whitespace.
Keep in mind that temp_name
and temp_id
are both arrays of type char.
I would greatly appreciate a quick solution to this issue.