Solved

Disk drive searching

Posted on 2001-06-07
10
247 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
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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
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…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

860 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