April 6th, 1999, 09:38 PM
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?
|
Click to See Complete Forum and Search --> : Drive Information? April 6th, 1999, 09:38 PM 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? Jerry Coffin April 6th, 1999, 10:20 PM 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. sue April 6th, 1999, 11:34 PM Try ::access(fname, mode) Masaaki April 7th, 1999, 01:06 AM 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- codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |