现在,这个问题可能看起来很奇怪,而且它可能确实是奇怪的,但为了给出一些背景,我一直在阅读这篇文章,学习i-node,其中作者给出了一个有趣的例子:
{
FILE *fp;
fp = fopen("some.hidden.file","w");
unlink("some.hidden.file"); /* deletes the filename part */
/* some.hidden.file no longer has a filename and is truly hidden */
fprintf(fp,"This data won't be found\n"); /* access the data part */
/*etc*/
fclose(fp); /* finally release the data part */
}
这允许创建一个“隐藏”的临时文件。
我的问题是:在调用 unlink() 后,是否有任何方法可以重新创建指向由 fp 打开的 inode 的文件名?
免责声明:我不打算在实际代码中这样做;我只是(重新)学习 i-node 并想知道是否可能。