By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,750 Members | 1,165 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,750 IT Pros & Developers. It's quick & easy.

Files in Folder

P: n/a
BB
Hi,
How do you retrieve the names of all files in a folder.
I am trying to execute a piece of code on all files in a folder supplied to
the program in the argument list.
What are the c++ commands for folder and file manipulations
Thanks
Jul 22 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
BB wrote:
Hi,
How do you retrieve the names of all files in a folder.
I am trying to execute a piece of code on all files in a folder
supplied to the program in the argument list.
What are the c++ commands for folder and file manipulations


Files can be manipulated through ifstream, ofstream and fstream, but C++
does not have a concept of "folder" or anything similar. So you can't
do what you want with the standard library. You need to use system
specific extensions.

Jul 22 '05 #2

P: n/a
BB wrote:
How do you retrieve the names of all files in a folder.
I am trying to execute a piece of code on all files in a folder supplied to
the program in the argument list.
What are the c++ commands for folder and file manipulations


There are no C++ commands for folders. But you could check:

http://boost.org/libs/filesystem/doc/index.htm

It is a filesystem library that works for POSIX and Windows
operating systems.

hth,

Christoph
Jul 22 '05 #3

P: n/a
On Thu, 18 Dec 2003 22:30:34 +0100, Christoph Rabel
<od**@hal9000.vc-graz.ac.at> wrote in comp.lang.c++:
BB wrote:
How do you retrieve the names of all files in a folder.
I am trying to execute a piece of code on all files in a folder supplied to
the program in the argument list.
What are the c++ commands for folder and file manipulations


There are no C++ commands for folders.


There are no C++ "commands" at all.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++ ftp://snurse-l.org/pub/acllc-c++/faq
Jul 22 '05 #4

P: n/a
Although there is no C++ command, but I think we can use system calls
like readdir, opendir - which are also of Posix Standard.
Gurus, correct me if I am wrong.

NGC

Jack Klein wrote:
On Thu, 18 Dec 2003 22:30:34 +0100, Christoph Rabel
<od**@hal9000.vc-graz.ac.at> wrote in comp.lang.c++:

BB wrote:
How do you retrieve the names of all files in a folder.
I am trying to execute a piece of code on all files in a folder supplied to
the program in the argument list.
What are the c++ commands for folder and file manipulations


There are no C++ commands for folders.

There are no C++ "commands" at all.


Jul 22 '05 #5

P: n/a
Nirmalya Ghosh Chowdhury writes:

[rearranged]
Jack Klein wrote:
On Thu, 18 Dec 2003 22:30:34 +0100, Christoph Rabel
<od**@hal9000.vc-graz.ac.at> wrote in comp.lang.c++:

BB wrote:

How do you retrieve the names of all files in a folder.
I am trying to execute a piece of code on all files in a folder supplied tothe program in the argument list.
What are the c++ commands for folder and file manipulations

There are no C++ commands for folders.

There are no C++ "commands" at all.

Although there is no C++ command, but I think we can use system calls
like readdir, opendir - which are also of Posix Standard.
Gurus, correct me if I am wrong.

NGC


I am not a guru, just a humble supplicant.

But do you really think that someone who won't allow a simple word
substitution is going to allow the introduction of a non-standard standard
into God's Chosen Standard? Hmmm?


Jul 22 '05 #6

P: n/a
osmium wrote:
Nirmalya Ghosh Chowdhury writes:

[rearranged]
Jack Klein wrote:
> On Thu, 18 Dec 2003 22:30:34 +0100, Christoph Rabel
> <od**@hal9000.vc-graz.ac.at> wrote in comp.lang.c++:
>
>
>>BB wrote:
>>
>>>How do you retrieve the names of all files in a folder.
>>>I am trying to execute a piece of code on all files in a folder supplied to >>>the program in the argument list.
>>>What are the c++ commands for folder and file manipulations
>>
>>There are no C++ commands for folders.
>
>
> There are no C++ "commands" at all.
Although there is no C++ command, but I think we can use system calls
like readdir, opendir - which are also of Posix Standard.
Gurus, correct me if I am wrong.

NGC


I am not a guru, just a humble supplicant.

But do you really think that someone who won't allow a simple word
substitution


It's good to tell people if they use wrong terminology. How else would
they learn to use the right one?
is going to allow the introduction of a non-standard standard
What is a "non-standard standard"?
into God's Chosen Standard? Hmmm?


What?

--
"computer games don't affect kids. I mean if pac man affected us as
kids, we'd all run around in a darkened room munching pills"

Jul 22 '05 #7

P: n/a
Rolf Magnus writes:
osmium wrote:
Nirmalya Ghosh Chowdhury writes:

[rearranged]
Jack Klein wrote:
> On Thu, 18 Dec 2003 22:30:34 +0100, Christoph Rabel
> <od**@hal9000.vc-graz.ac.at> wrote in comp.lang.c++:
>
>
>>BB wrote:
>>
>>>How do you retrieve the names of all files in a folder.
>>>I am trying to execute a piece of code on all files in a folder

supplied to
>>>the program in the argument list.
>>>What are the c++ commands for folder and file manipulations
>>
>>There are no C++ commands for folders.
>
>
> There are no C++ "commands" at all.

Although there is no C++ command, but I think we can use system calls
like readdir, opendir - which are also of Posix Standard.
Gurus, correct me if I am wrong.

NGC


I am not a guru, just a humble supplicant.

But do you really think that someone who won't allow a simple word
substitution


It's good to tell people if they use wrong terminology. How else would
they learn to use the right one?


I have no objection to a correction, if it is meant to be informative. The
above is phrased in too subtle a manner for a beginner to understand; it is
preaching to the choir. A statement of the form:

C does not have "commands". What you
probably mean is "function call"

would be an understandable correction. To simply say "C doesn't have
commands" is simply snide. A person who doesn't already know the answer is
simply left with a "What is this all about?" feeling.
is going to allow the introduction of a non-standard standard


What is a "non-standard standard"?
into God's Chosen Standard? Hmmm?


What?


A standard that has not been approved by ISO/ECMA/ANSI/whatever. It's the
difference between de facto and de jure.
Jul 22 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.