Find a file with c++

K

Ken

Hello,

I'm trying to make a c++ program that first looks for a specific file
and then edits it. This file can be everywhere on the computer.
Someone any idea how i can search the computer for a specific file in
c++ ?

Greetings,

Ken
 
T

Thomas Matthews

Ken said:
Hello,

I'm trying to make a c++ program that first looks for a specific file
and then edits it. This file can be everywhere on the computer.
Someone any idea how i can search the computer for a specific file in
c++ ?

Greetings,

Ken

There are no facilities in C++ for searching for files.
You will have to use platform specific functions.
Please read the welcome.txt in my signature as well
as these sections of the FAQ:
http://www.parashift.com/c++-faq-lite/input-output.html

The reason is that not all platforms support
directories. Of those that do, not all of them
have the same directory structure or organization.
Compare for example: MacIntosh, Windows, Unix and
VMS platforms. If you want extremes, consider other
operating systems and embedded systems that don't
have files. See
--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book
 
D

David Rubin

Ken said:
Hello,

I'm trying to make a c++ program that first looks for a specific file
and then edits it. This file can be everywhere on the computer.
Someone any idea how i can search the computer for a specific file in
c++ ?

You must use 3rd party libraries to do this in C++. Another method is to
wrap your program in a script which first finds the file and then calls
your program to edit it.

/david
 
E

Evan Carew

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello,

I'm trying to make a c++ program that first looks for a specific file
and then edits it. This file can be everywhere on the computer.
Someone any idea how i can search the computer for a specific file in
c++ ?

Greetings,

Ken
Ken,

While the comments of the previous posters are technically correct,
there is help (tho not a complete solution) for generic file ops. For an
idea of what is possible, take a look at Boost's filesystem library at:

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

Evan Carew
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFALVL2oo/Prlj9GScRApTKAJsHEO0z+wudSxlZ6To83OH24wUcKwCfc8gQ
8E+eho8BztBWCa29O1/HPDQ=
=g2K+
-----END PGP SIGNATURE-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,061
Latest member
KetonaraKeto

Latest Threads

Top