|
Note: readdir is the readdir c runtime function.
readdir() is a Unix-type API (a system API), and is not part of the C runtime library.
Just curious to know what deallocate the memory that return from readdir(dir_ptr). I try to do "dealloc myDirEnt_Ptr" right before the next readdir and the program failed. I guess that is not necessary.
You should not deallocate the memory used by readdir(). The system automatically allocates the memory when opendir() is called, re-uses the same memory for every call to readdir(), and then deallocates it when closedir() is called.
If you deallocate it yourself (assuming the system even allows you to do that) you'll confuse the API and unpredictable results will occur.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.