我正在从文件中读取此文本:
file1: file2,file3,file4
file10: testfile.h
file1: file9
并将其拆分
while(fscanf(fp,"%[^:]: %s",map[i].name, map[i].filesNeeded) == 2)
{
printf("%s %s",map[i].name, map[i].filesNeeded);
i++;
}
问题是第二个和第三个变量是用前导换行符保存的:
Details:{name = "\\nfile10", '\\000' <repeats 56 times>, filesNeeded = "testfile.h", '\\000' <repeat
如何在没有前导换行符的情况下保存它?