先将所有的读进来存在一个字符串中,然后用字符分割函数strtok()//具体可参见API
例如:
char str[] = "now # is the time for all # good men to come to the # aid of their country";
char delims[] = "#";
char *result = NULL;
result = strtok( str, delims );
while( result != NULL ) {
printf( "result is \"%s\"\n", result );
result = strtok( NULL, delims );
}
以上代码的运行结果是:
result is "now "
result is " is the time for all "
result is " good men to come to the "
result is " aid of their country"