The following was meant to remove punctuation from a list of imported words. Is there a correct way of doing this?
Code:
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main(void)
char * word_list = "greg.john,steve!julie";
char * punc_mark = "!@#$%^&*(),.<>[]{};':\"";
for ( int wlidx = 0; wlidx < strlen( word_list ); wlidx++ )
{
for ( int pmidx = 0; pmidx < strlen( pmidx ); pmidx++)
if ( word_list[wlidx]==punc_list[pmidx])
word_list[wlidx]=' ';
}
{
FILE *fp = fopen("./testl.txt", "r");
char result[128];
while (!feof(fp))
{
if (fscanf(fp, "%128s", result)<1)
{
break;
}
printf("Found word bit: %s \n", result);
}
fclose(fp);
}