你好我有行格式的文本文件
1|few ewf ew fewfew
我需要解析它,但我不知道如何从我不知道的第二个值中删除空格尾部。
segmentation fault
到目前为止,这是我的尝试
char* token1;
char* token2;
char* search = "|";
char* search2 = " "; // double space because string can contains single space
while (fgets(line, 150, f)) {
token1 = strtok(line, search);
token2 = strtok(search, search2); // <- segfault
//token2 = strtok(NULL, search); <- contains a lot of spaces in tail