Anybody know how to get a list of mounted drives via PureBasic, or 
by polling another app and redirecting the output to a PureBasic app?
Thanks,
-Garrett
			
			
									
									Get list of mounted drives?
- 
				garretthylltun
- Enthusiast 
- Posts: 346
- Joined: Wed Oct 26, 2005 2:46 am
- Contact:
Get list of mounted drives?
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
· Necroprogramming FTW! - "Wait.. Is necroprogramming legal?"
· http://www.freewarehome.com/ <-- Freeware listings since 1996
						· Necroprogramming FTW! - "Wait.. Is necroprogramming legal?"
· http://www.freewarehome.com/ <-- Freeware listings since 1996
You could pipe the output of 'mount'.  Here is an example:
Got this from Freak and I use it all the time...  Thanks again Freak!

			
			
									
									
						Code: Select all
Procedure.s ConsoleCommand(Command$)
    Output$ = ""
    Pipe = popen_(Command$, "r")
    If Pipe
    
      *Buffer = AllocateMemory(2000)
      If *Buffer
    
        Repeat
          result = fgets_(*Buffer, 2000, Pipe)
          If result         
            Output$ + PeekS(*Buffer)         
          EndIf
        Until result = 0
    
      EndIf
    
      pclose_(Pipe)
    EndIf
    
    ProcedureReturn Output$
EndProcedure
mount$ = ConsoleCommand("mount")
- 
				lexvictory
- Addict 
- Posts: 1027
- Joined: Sun May 15, 2005 5:15 am
- Location: Australia
- Contact:
i recently downloaded the linux beta, and started to play with this.....
and since i'm new to linux programming, it surprised me when i actually got it to work!
but it only works in ASCII mode (or is that the same with all 'linux api' commands?)
			
			
									
									and since i'm new to linux programming, it surprised me when i actually got it to work!
Code: Select all
Structure mntent
mnt_fsname.s
mnt_dir.s
mnt_type.s
mnt_opts.s
mnt_freq.l ; may not be right data type
mnt_passno.l ; may not be right data type
EndStructure
mtab = setmntent_("/etc/mtab", "r")
If mtab
  *info.mntent
  pointer = getmntent_(mtab)
  While pointer
    *info = pointer
    Debug *info\mnt_fsname
    Debug *info\mnt_dir
    Debug *info\mnt_type
    Debug *info\mnt_opts
    Debug "---------"
    pointer = getmntent_(mtab)
  Wend
  endmntent_(mtab)
EndIf
Demonio Ardente
Currently managing Linux & OS X Tailbite
OS X TailBite now up to date with Windows!
						Currently managing Linux & OS X Tailbite
OS X TailBite now up to date with Windows!