--- In [email protected], andrew clarke <[EMAIL PROTECTED]> wrote: > > On Mon 2008-05-12 21:08:56 UTC-0000, hafsa.alhosani ([EMAIL PROTECTED]) wrote: > > > Here is my code that will return the next file in a directory: > > Well, clearly it does a bit more than what you describe! > > It's fairly obvious that you're just "stabbing in the dark" > with your code. It has a number of faults and design flaws, > eg. your code will break with filenames longer than 12 > characters.
Typical for MS-DOS applications and Turbo C/C++. > With regards to the findfirst() issue, you should really be > using opendir() instead. Unfortunately that might not work, depending on the compiler you work with. opendir() is one of many POSIX compliant functions that have not been implemented by Microsoft; instead they have defined their own function FindFirst() and Findnext() for these tasks, so POSIX conformant source codes cannot too easily be ported to Windows. There are compiler environments which emulate opendir() and related functions under Windows; as far as I know CygWin is one popular POSIX conformant environment, MS VC++ and related compilers are not, about other compilers I cannot say. For Unix-like environments I totally concur that opendir() and its relatives are a good choice here. Regards, Nico
