?
Solved

Disk drive searching

Posted on 2001-06-07
10
Medium Priority
?
270 Views
Last Modified: 2010-04-02
I need a source code in C++ that will do this:
   Searches and find a file in a disk drive, when I type the name of the file that I am looking for after a promt line.
0
Comment
Question by:uta2002
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 4

Expert Comment

by:captainkirk
ID: 6164041
I take it this is a console application that you are writing - there are utilities to do this very same thing, so I must assume this is a homework assignment....

Can you post what code you have so far and then we can help you move it along????

0
 
LVL 30

Accepted Solution

by:
Axter earned 200 total points
ID: 6164061
Since ANSI C++ does not support this type of functionality, you have to use OS specific code.

What is your OS, and compiler?

For Windows and DOS, use the findfirst and findnext functions.

For Unix opendir and readdir functions
0
 
LVL 2

Expert Comment

by:MadYugoslav
ID: 6166660
Agree with Axter. Post information about OS and Compiler.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 7

Expert Comment

by:KangaRoo
ID: 6166749
opendir and readdir should work on most Unixes as well as Dos/Windows when using Borland C or GCC.
0
 
LVL 30

Expert Comment

by:Axter
ID: 6167508
>>opendir and readdir should work on most Unixes as well
>>as Dos/Windows when using Borland C or GCC.
I didn't know that.  I can see why GCC would support opendir, but I wonder why Borland C supports it.

Do they also support findfirst?
0
 
LVL 18

Expert Comment

by:deighton
ID: 6167786
>>so I must assume this is a homework assignment....

Might be too harsh, I came here because I need to do this also - but not for homework, if only I *was* a student again :-)
0
 
LVL 7

Expert Comment

by:KangaRoo
ID: 6167878
>> I wonder why Borland C supports it
Dunno either, but they do, at least Borland mentions them (directory streams) in the help files :)

Maybe it's homework, maybe he just wants a nice tool to find a file once in a while. I've been contemplating an easier version of change-dir (their used to be a dos tool like it)
0
 
LVL 30

Expert Comment

by:Axter
ID: 6167912
>>I've been contemplating an easier version of change-dir
>>(their used to be a dos tool like it)

I created wrapper functions to allow findfirst/findnext to work with compilers that only support opendir/readdir.

I did that so I didn't have to change my code when I port it to unix.  But I guess now I could use it if I ever need to port it to Borland C or GCC.
0
 
LVL 11

Expert Comment

by:griessh
ID: 6811677
I think you forgot this question. I will ask Community Support to close it unless you finalize it within 7 days.
Unless there is objection or further activity,  I will suggest to accept "KangaRoo" comment(s) as an answer.

If you think your question was not answered at all, you can post a request in Community support (please include this link) to refund your points.
The link to the Community Support area is: http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt

Please do not accept this comment as an answer!
======
Werner
0
 
LVL 5

Expert Comment

by:Netminder
ID: 6828407
Force/accepted by

Netminder
Community Support Moderator
Experts Exchange
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses
Course of the Month12 days, 15 hours left to enroll

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question