NO

Author Topic: most important part of struct dirent is missing  (Read 3609 times)

Seltsamuel

  • Guest
most important part of struct dirent is missing
« on: May 20, 2009, 01:59:24 AM »
Hi Pelle,

im really surprised no one ran against this before:

struct dirent in Pelles c only has a dummy and the name but what about the most important Member
d_type ?
d_type==DT_DIR  means its a directory
d_type==DT_REG means its a regular file

Without it the functions opendir readdir .. .. are useless becaus i cannot see whats a file and whats a directory

PS im working with version 5.00.6 of PellesC

Greetings

Seltsamuel

Offline Pelle

  • Administrator
  • Member
  • *****
  • Posts: 2266
    • http://www.smorgasbordet.com
Re: most important part of struct dirent is missing
« Reply #1 on: May 20, 2009, 07:29:10 PM »
Not a bug. Only d_name and d_ino are defined for the dirent structure in POSIX (other fields may exist, but are optional). No action for v6.0, at least.
/Pelle

Seltsamuel

  • Guest
Re: most important part of struct dirent is missing
« Reply #2 on: May 20, 2009, 08:49:54 PM »
Hi,

ehm Pelle sorry but then delete this at all because they have no use.
For now i use findfirst findnext but at first i used the other commands for my code because i saw inside the helpfile that PellesC has them
only to delete the code after i saw the missing structure members. When i cannot determine its a file or direntry the complete thing is for the dustbin.

Please remove them and make a reference to findfirst/findnext inside the help thats the better way and at least would have spared my time.

Greetings

Seltsamuel

JohnF

  • Guest
Re: most important part of struct dirent is missing
« Reply #3 on: May 20, 2009, 10:08:28 PM »
There are many examples of dirent on the web that are free to download.

John

Seltsamuel

  • Guest
Re: most important part of struct dirent is missing
« Reply #4 on: May 20, 2009, 11:10:21 PM »
Hi,

@JohnF
Hi i have examples enough im working mostly on the Linux side and thats the reason i would prefere opendir readdir and closedir
but there is no point in using it with PellesC when the only working structmember is the name of the entry and not the type.
All my examples make heavy usage of "d_type" and there is no point in making fstat on every name readdir delivers ^^.

Greetings

Seltsamuel


JohnF

  • Guest
Re: most important part of struct dirent is missing
« Reply #5 on: May 20, 2009, 11:19:49 PM »
Not really a problem - with those examples I talked about you can have any struct member you like by adding it yourself.

John

Seltsamuel

  • Guest
Re: most important part of struct dirent is missing
« Reply #6 on: May 21, 2009, 02:47:08 PM »
Hi,

@JohnF
Sure John i can even write my own fwrite and my own printf but that was not the point for this topic ;-)
I only wanted to tell the INCLUDED functions as they are are useless and better exchanged with a reference to other functions that do the work i expect them to do. I did this and Pelle has to decide what to do :-) i for myself have a working workaround.

Greetings

Seltsamuel