سؤال

In C what if I read a file using a FILE pointers and fgets or fread
(like FILE *f) and the file is renamed ?

هل كانت مفيدة؟

المحلول

Presumably it depends on the operating system. Under Unix-like operating systems (eg. Linux), you can read the file not just if it's renamed, but even if it's deleted: an open filehandle refers to the file's data, not to its directory entry.

نصائح أخرى

I'd expect the result to be operating system specific, and probably even file system specific. There are no guarantees by C.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top