473,405 Members | 2,300 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Find a file with c++

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
Jul 22 '05 #1
3 5366
Ken wrote:
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 news:comp.arch.embedded.

--
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

Jul 22 '05 #2
Ken wrote:
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

--
As a scientist, Throckmorton knew that if he were ever to break wind
in the echo chamber, he would never hear the end of it.
-- unknown
Jul 22 '05 #3
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Ken wrote:
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-----
Jul 22 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: hokieghal99 | last post by:
import os, string print " " setpath = raw_input("Enter the path: ") def find_replace(setpath): for root, dirs, files in os.walk(setpath): fname = files for fname in files: find =...
6
by: Peter Hansen | last post by:
Greetings. Im trying to write a program that can be run from the command line. If I want to search for example after a file with the ending .pdf, I should be able to write in the command line:...
1
by: Xah Lee | last post by:
suppose you want to do find & replace of string of all files in a directory. here's the code: ©# -*- coding: utf-8 -*- ©# Python © ©import os,sys © ©mydir= '/Users/t/web'
1
by: Pierre-Yves | last post by:
Hello, I have to loop recursively in directories to build a tree. Based on the directory name, I know I can skip some (i.e: the BACKUP ones) to improve the performances that are currently very...
1
by: Dan Jones | last post by:
I'm writing a script to process a directory tree of images.  In each directory, I need to process each image and generate an HTML file listing all of the images and links to the subdirectories....
5
by: Tim Eliot | last post by:
Just wondering if anyone has hit the following issue and how you might have sorted it out. I am using the command: DoCmd.TransferText acExportMerge, , stDataSource, stFileName, True after...
0
by: Michael R. Pierotti | last post by:
Has anyone seen this error before when trying to make the install on a program. ------ Starting pre-build validation for project 'HafaSMPPInstall' ------ WARNING: Unable to find dependency...
0
by: Xah Lee | last post by:
Interactive Find and Replace String Patterns on Multiple Files Xah Lee, 2006-06 Suppose you need to do find and replace of a string pattern, for all files in a directory. However, you do not...
5
by: peter | last post by:
Hello all, I'm looking for an advice. Example (one block in ascii file): $------------------------ NAME='ALFA' CODE='x' $------------------------
3
by: mouac01 | last post by:
Newbie here. How do I do a find and replace in a binary file? I need to read in a binary file then replace a string "ABC" with another string "XYZ" then write to a new file. Find string is the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.