CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Guest

    Drive Information?

    After browsing for a file path, I want my app to determine whether or not the drive is read-only (e.g. a CD-ROM drive). Is there an easy way to do this?


  2. #2
    Join Date
    May 1999
    Posts
    123

    Re: Drive Information?

    GetDriveType will tell you some things about the drive (e.g. that it is a CD-ROM). Simply trying to open a file for writing will tell you about whether you can write to the drive (which may be related to whether you've been given right to do so or not rather than anything about the drive itself).

    The universe is a figment of its own imagination.

  3. #3
    Join Date
    Apr 1999
    Posts
    6

    Re: Drive Information?

    Try ::access(fname, mode)


  4. #4
    Join Date
    May 1999
    Location
    Atlanta, GA, USA
    Posts
    443

    Re: Drive Information?

    Hi.

    Try this.
    UINT nType = ::GetDriveType((LPCSTR)strDrive);
    nType get the following type.
    0 -> UnKnown drive type.
    1 -> Root directory does not exists.
    DRIVE_REMOVABLE -> A DRIVE
    DRIVE_FIXED -> HARD DRIVE
    DRIVE_REMOTE -> NET WORK DIRVES
    DRIVE_CDROM -> CD-ROM DIRVE
    DRIVE_RAMDISK -> RAM DRIVE

    But this may be a little different from your rquest like read_only.
    In addition, now there exists rewritabel CD-ROM.
    So, try to save something, and if it get error message, it is read only?

    Hope for help.
    -Masaaki Onishi-


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured