<分区>
我有一个自定义存档,其结构如下:
%list% name1 name2 name3 %list%
%dirs% archive directories %dirs%
%content% name1 path1 content of file1 %content%
%content% name2 path2 content of file2 %content%
%content% name3 path3 content of file3 %content%
%list% 包含归档文件的名称
%dirs% 包含目录名称
%content% 列出文件内容。
因为我需要打印指定文件的内容,所以我想逐字读取这个存档,以便识别%content%
标签和文件名。
我知道 fscanf()
的存在,但它似乎只有在您知道存档模式时才能有效地工作。
是否有 C 库或命令,如 C++ 的 ifstream
,允许我逐字阅读?