File or Directory?

Determining If a Filename Is a File or a Directory

Page 1 of 1

1 Replies - 1336 Views - Last Post: 10 April 2007 - 09:25 PM Rate Topic: -----

#1 martina  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 13-March 07

File or Directory?

Posted 10 April 2007 - 11:03 AM

Programming in C.

How can I determine if a filename is file or directory ?
Is there anything similar to java's isDirectory() function in C ?
Is This A Good Question/Topic? 0
  • +

Replies To: File or Directory?

#2 NickDMax  Icon User is offline

  • Can grep dead trees!
  • member icon

Reputation: 2255
  • View blog
  • Posts: 9,245
  • Joined: 18-February 07

Re: File or Directory?

Posted 10 April 2007 - 09:25 PM

What platform are you one (windows/linux etc). How old is your compiler?

Basicly no. C does not have any built in directory support. There used to be "dir.h" and "dos.h" but they were not standard then and are not standard now.

The big reason for this (though I think it is a cheap excuse) is that directories are a very operating system/platform spacific thing so you need to use your operating system to do this sort of thing.

Now Boost has some directory abilities, and if we know your platform/compiler I am sure your compiler also has a means of doing what you need.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1