|
Reading character by character is too slow
You can allocate a large enough string, such as 1024 bytes, use the fgets function to read one line of content at a time, and then use the strchr or strstr function to intercept the content one by one according to the separator, and then loop
char szBuffer[1024];
while(!fgets(szBuffer, fp)) {
if (strchr(szBuffer,'#')) {
}
if (strchr(szBuffer,'*')) {
}
if (strchr(szBuffer, '&')) {
}
if (strchr(szBuffer,'$')) {
}
if (strchr(szBuffer,'!')) {
}
} |
|