Mapping out a hard drive.

This is a discussion on Mapping out a hard drive. within the Windows Programming forums, part of the Platform Specific Boards category; This will probably be a unanswerd question becouse it's of the wall, But here goes.. I want to make a ...

  1. #1
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342

    Question Mapping out a hard drive.

    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.

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    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

  3. #3
    Chief Code Coloniser!
    Join Date
    Apr 2005
    Posts
    121
    This will probably be a unanswerd question

    You're right when you consider you didn't actually ask one!

  4. #4
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    Here is an example of what I mean:

    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\cookie@host.com
    It would write a path to every file and folder on the computer.

  5. #5
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    FindFirstFile/FindNextFile

  6. #6
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    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.

  7. #7
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    Do the "FindFirstFile/FindNextFile" work?
    My question is: how can I do what I want to do?

  8. #8
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    I mean, would the "FindFirstFile/FindNextFile" work for what I want to do?

  9. #9
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    how can I do 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.

  10. #10
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    Okay, why isn't this working?
    Code:
    FindFirstFile("*.*",NULL);
    The compiler didn't come up with any errors or warnings, but when I executed the app,
    A "Program error" dialog came up.

  11. #11
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    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.

  12. #12
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    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.

  13. #13
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    Okay, is there a way I can get it to write the First File Found to a MessageBox?

  14. #14
    Registered User
    Join Date
    Jan 2005
    Posts
    847
    Code:
    MessageBox(NULL, wfd.cFileName, NULL, MB_OK);
    assuming your WIN32_FIND_DATA structure is named wfd.

  15. #15
    Registered User Queatrix's Avatar
    Join Date
    Apr 2005
    Posts
    1,342
    Is there a way to do the same thing but with FindNextFile?

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Extracting data from a laptop hard drive
    By DavidP in forum Tech Board
    Replies: 6
    Last Post: 06-13-2009, 07:02 AM
  2. Detect SCSI Hard Drive Serial Number
    By mercury529 in forum Windows Programming
    Replies: 3
    Last Post: 10-17-2006, 06:23 PM
  3. Replies: 2
    Last Post: 07-06-2005, 07:11 PM
  4. Trinary Hard Drive
    By nickname_changed in forum Tech Board
    Replies: 14
    Last Post: 05-13-2005, 10:01 AM
  5. hard drive problems continually increasing
    By DavidP in forum Tech Board
    Replies: 5
    Last Post: 11-21-2002, 09:48 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21