Re: directory handle [some OT]

From: Bob R (removeBadBobR_at_worldnet.att.net)
Date: 08/03/04


Date: Tue, 03 Aug 2004 02:02:32 GMT


osmium wrote in message <2n5013Ft5fs4U1@uni-berlin.de>...
>Edo writes:
>> I never came across any examples that handle directories in all the
>> examples I read and played with.
>>
>> How does C++ handle directories?
>> Like if I create an ofsream object with a path name, which has a
>> directory that does not exist, why not create it since it creates the
>> file, which does not exist in this case.

It will, if you use the correct call to your OS.
Linux, DOS, window$ and any system that uses 'directories' will usually
have a routine to create them. Look them up in your OS books.
Each OS has their own way of storing the structures/info to a storage
device, so, don't look for any 'standard' in a platform independant
language any time soon! <G>

>>
>> Also how do I iterate over all the files in a given directory or over
>> all the subdirectories of a directory.
>> Is there a <directory> lib of some sort?

Yes! It's called an 'Operating System'!

>
>C++, and C as well, have no built in provisions to deal with directories.
>So you are left to use whatever is supplied with your compiler. I find
that
>just as annoying as you probably will. The reason cited is usually along
>the lines of "My bread maker doesn't even *have* directories".

My 1979 Apple II [1] didn't have 'directories' until years later when I put
'ProDos' on it's 5.25 boot floppies (..and later, a 10Meg HD! wow, all the
room anyone could ever need! (now struggling to keep some free space on a
60Gig system!)).
And how did we get from the *standard* 'toaster' example to 'bread
makers'??

Is Edo a troll?

[1] - It came with a whopping 16k memory, but I quickly upgraded to 48k so
I could use 16 color graphics!! WOW! (and had to split my assembler
programs around the graphics buffer, some below, some above!). Burns my
buns to hear todays kids complain because some game doesn't have
1600x1200x32bit FMV!!! Wimps!
Typed this pretty quick, corrections welcomed. <G>

--
Bob R
POVrookie
--
MinGW (GNU compiler): http://www.mingw.com/
Dev-C++ IDE: http://www.bloodshed.net/
V IDE & V GUI: http://www.objectcentral.com/
POVray: http://www.povray.org/
Good C++ book: http://www.mindview.net/Books
alt.comp.lang.learn.c-c++: ftp://snurse-l.org/pub/acllc-c++/faq
  temp: http://www.contrib.andrew.cmu.edu/~ajo/docs/FAQ-acllc.html