Searching for a file in the computer[closed]

Hi everyone,
I have a program which generates a string for the file entered.
(The length of the string will be equal irrespective of the file size)Here the path of he file is to be entered specifically for generating the string.
And I have to give the path of the second file to compare those two files and thereby declaring those two files are same.

Now, I have defined the string value for the second file in my program and I want the get the string values of all files present in the computer so that I find the presence of file in the system.

"FindFirstFile" function is is used for searching the whole computer by the name of the files but I want to search the file by its string value generated by my program.

how can I achieve this? Can you suggest any ways, methods, functions,links, etc.,

Thank you in advance.
Last edited on
That's really confusing. I don't quite understand the question.
I highly recommend using a 3rd party library for this.

Try boost::filesystem: http://www.boost.org/doc/libs/1_59_0/libs/filesystem/doc/index.htm

The website is full of examples.
"FindFirstFile" function is is used for searching the whole computer.


You can use FindFirstFile to search a specific directory - just put the path in front of the filename.

string value
Does it mean filename?
From what understood
1) Get filename from user
2) (using some algorithm) convert filename in a string
3) traverse computer using FindFirstFile (assuming you are on Winidows)
4) compare the filename with your generated string

If this is correct then you need to convert the name of the file from FindFirstFile/FindNextFile using the same algorithm used to convert filename got from step one, then compare the resultant strings.

You cannot ask FindFirstFile to search for your converted string as it does not (have any way to) know your algorithm to do so.
Hope this helps
Hi everyone,
First of all thank you for your replies.I hope I didn't explain my question clearly.Here is a brief explanation of my problem:

My program will generate a string e.g "7CBBAC403976BABF7DBBC005EF201A6C1DB3DF48" for the file entered. The string value does not depend on file name, extension etc.,

example :

example.exe = 7CBBAC403976BABF7DBBC005EF201A6C1DB3DF48

and the file is renamed to test.exe without modifying the contents of the file .The output will not change

i.e test.exe = 7CBBAC403976BABF7DBBC005EF201A6C1DB3DF48

But when the contents of the file is modified the output will be modified.

So here is were I have been struck:

My program will check the string value for the two files and check whether those to files are same.

Here I have to enter the location of two files specifically for confirmation. But I have defined the string value of one file in my code

like string a =7CBBAC403976BABF7DBBC005EF201A6C1DB3DF48;

and I have to make my program to get the string value for each and every files of the computer on which my executable runs and find the string which matches the string a.
Topic archived. No new replies allowed.