Solved

Disk drive searching

Posted on 2001-06-07
10
260 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 50 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
Industry Leaders: 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

691 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