Solved

Disk drive searching

Posted on 2001-06-07
10
234 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
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…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

911 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now