   How to detect if running from unwritable drive
  Hi, What API Calls should I google for, dealing with the detection that my app is running from the a CD or any other type of unwritable medium (like a locked floppy, or a locked USB disk), so that I don''t write logs, etc to the medium, which would cause a failure?Thanks for any help on this...   [Hugo Ferreira][Positronic Dreams][Colibri 3D Engine][Entropy HL2 MOD]    [Yann  L.][Enginuity]  [Penny Arcade]  [MSDN][VS  RoadMap][Humus][BSPs][UGP][NeHe]"I say we take off and nuke the entire site from orbit. It''s the only way to be sure." 
  Try to create a file. If it fails, you don''t have write access  “Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.”    — Brian W. Kernighan (C programming language co-inventor);  How about trying to open a file with write mode; if it fails, you can pretty much assume the drive is unwritable.Otherwise check out the MSDN focuments for File I/O ;  try to open a file and if it fails ?maybe the user just doesnt have permissions on that computer to create new files ?   "A soldier is a part of the 1% of the population that keeps the other 99% free"  - Lt. Colonel Todd, 1/38th Infantry, Ft. Benning, GA ;quote:Original post by ncsu121978  try to open a file and if it fails ?maybe the user just doesnt have permissions on that computer to create new files ?Which is, in practice, not different from running of an "unwritable medium". It is easier to directly check for the inability to write (which is what the OP wants to check for, by the way), than to try and cover all the possible reasons why writing might fail. ;  OK, let me put in another form: how do i detect the system''s drives, their properties, and the one my program is running of?   [Hugo Ferreira][Positronic Dreams][Colibri 3D Engine][Entropy HL2 MOD]    [Yann  L.][Enginuity]  [Penny Arcade]  [MSDN][VS  RoadMap][Humus][BSPs][UGP][NeHe]"I say we take off and nuke the entire site from orbit. It''s the only way to be sure." ;  To get the drive that the program is running off of: char chDriveLetterGetModuleFileName(GetModuleHandle(NULL),&chDriveLetter,1);And theres GetDriveType to see what type of drive it is 