I'm trying to write a C list filtering function that receives a country string, traverses the list and deletes all nodes with node->country == country
. The problem is that node->country
strings end with '\n'
(because it's being read from a csv file) and therefore strcmp(node->country, country)
never equals zero.
How would I solve this? I first thought about appending '\n'
to country but that would probably raise more memory problems. Also thought about strstr
but I don't really know how to work with that.
Thanks for any suggestions.