This will probably be a unanswerd question becouse it's
of the wall, But here goes..
I want to make a simple program that makes a map of the hard drive that the program is on. It would write to a file with the results.
Thanks, August.
This will probably be a unanswerd question becouse it's
of the wall, But here goes..
I want to make a simple program that makes a map of the hard drive that the program is on. It would write to a file with the results.
Thanks, August.
What do you mean by map? occupied sectors? full folder map? few more details would help you get an answer.
Free the weed!! Class B to class C is not good enough!!
And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi
This will probably be a unanswerd question
You're right when you consider you didn't actually ask one!
Here is an example of what I mean:
It would write a path to every file and folder on the computer.C:\Documents and Settings\Administrator\My Documents\file1.txt
C:\Documents and Settings\Administrator\My Documents\file2.txt
C:\Documents and Settings\Administrator\My Documents\file3.txt
C:\Documents and settings\Administrator\Cookies\[email protected]
FindFirstFile/FindNextFile
Okay, you've told us what kind of program you want to write, but you still haven't asked us a question. We're not going to write your whole program for you. If you're having trouble getting started look up the Win32 functions given to you above.
Do the "FindFirstFile/FindNextFile" work?
My question is: how can I do what I want to do?
I mean, would the "FindFirstFile/FindNextFile" work for what I want to do?
Go to MSDN and learn how to use the functions suggested to you, write some code, and then come to us with any specific problems you have.how can I do what I want to do?
Okay, why isn't this working?
The compiler didn't come up with any errors or warnings, but when I executed the app,Code:FindFirstFile("*.*",NULL);
A "Program error" dialog came up.
That's because the second parramater should be a pointer to a WIN32_FIND_DATA structure and you set it too NULL so when the function tried to save the file information you're program crashed.
First declare a WIN32_FIND_DATA structure and then pass it's address to FindFirstFile and you should also save the Find handle.
Code:WIN32_FIND_DATA wfd; HANDLE hFind; hFind=FindFirstFile("*.*", &wfd);
Last edited by Quantum1024; 05-01-2005 at 11:36 AM.
I'm not sure of the exact reason for a "Program error" dialog, but this hardly looks like what you'd want to be doing. You're not collecting the return value (file handle), and you're not collecting any of the other information for the file - you're using the function improperly and this very well could be causing the problem.
Okay, is there a way I can get it to write the First File Found to a MessageBox?
assuming your WIN32_FIND_DATA structure is named wfd.Code:MessageBox(NULL, wfd.cFileName, NULL, MB_OK);
Is there a way to do the same thing but with FindNextFile?