So currently I have this code that allows me to import words from a text file and store it in to an array, what I would like it to do is ignore any punctuation such as "," - "." - etc.
However I am unable to do so with %[,]s
or something similar seen below, any help on this please?
#include <stdio.h>
#include <string.h>
int main()
{
FILE *myFileHandle;
myFileHandle = fopen("test1.txt", "r");
char *lineofText;
if (myFileHandle != NULL){
while (!feof(myFileHandle)){
fscanf(myFileHandle, "%[,]s", lineofText);
puts(lineofText);
}
}
fclose(myFileHandle);
}
Thanks.