如果我有一个文件包含

manual
/lib/plymouth/themes/default.plymouth

/lib/plymouth/themes/spinfinity/spinfinity.plymouth
10
/lib/plymouth/themes/ubuntu-logo/ubuntu-logo.plymouth
100

and then I open it in a mode, then do

fprintf(f, "/el/derpito.plymouth\n100\n");


为什么文件现在包含这个?

手册
/lib/plymouth/themes/default.plymouth

/lib/plymouth/themes/spinfinity/spinfinity.plymouth
10
/lib/plymouth/themes/ubuntu-logo/ubuntu-logo.plymouth
100

/el/derpito.plymouth
100

我希望文件改为:

手册
/lib/plymouth/themes/default.plymouth

/lib/plymouth/themes/spinfinity/spinfinity.plymouth
10
/lib/plymouth/themes/ubuntu-logo/ubuntu-logo.plymouth
100
/el/derpito.plymouth
100

最佳答案

在进行写操作之前,文件末尾可能会有一个孤独的\ n或\ cr。我会用十六进制编辑器打开它,然后看看。

08-24 14:34