1

Is there a c function in Gcc to set current drive (not just directory/folder). chdir() changes folder but I need to set the "active" drive (as in C:, D: etc.) Some compilers have _dos_setdrive() and chdrive() and Windows has its own but I could not find equivalent for gcc. My platform is do command prompt but Im also looking for Linux port (dunno if Linux has "drives"?)

user1231247
  • 193
  • 1
  • 8

1 Answers1

1

Linux does not have drives. It has partitions. However, these are presented as one unified filesystem. Partitions are simply mounted at different directories. Therefore, there is no changing drives, just directories.

As for Windows, you need to use the Win32 API with MinGW (Assuming that is what you meant, otherwise if you are using Cygwin you would just chdir the same as linux, to /cygdrive/driveletter). Please see this question: How to use the Windows API in MinGW?

Community
  • 1
  • 1
bodangly
  • 2,473
  • 17
  • 28