🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #5442

Re: Local or remote drive ?

#5442
From: Vladimir Stefanovic
Date: Mon, 15 Aug 2005 17:04
37 lines
1727 bytes
> How to know if a file is on a local drive or remote drive ?

Look at API GetDriveType().

This is in practice how I get the first CD ROM drive
(probably can be optimized):

AnsiString GetFirstCdRomDrive()
{
  unsigned long r;
  char Drives[129];
  char* pDrive;
  AnsiString Result = "";

  r = GetLogicalDriveStrings( sizeof( Drives ), Drives );

  if ( r == 0 )
     return ( Result );
  if ( r > sizeof( Drives ) )
     return( Result );

  pDrive = &Drives[0];  // Point to the first drive

  while ( *pDrive != NULL )
  {
     if ( GetDriveType( pDrive ) == DRIVE_CDROM )
       return ( UpperCase ( (char)*pDrive ) + ":\\" );
     pDrive += 4;  // Point to the next drive
  }

  return( "" );
}


-- 
Best regards,
Vladimir Stefanovic 
Technical Details
Message-ID: <4300cb1d@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news.moat.net!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.newsfeeds.com!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <4300c890@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,69972cb9555f348
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Vladimir Stefanovic" <antivari@po.sbb.co.yu>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <4300c890@newsgroups.borland.com>
Subject: Re: Local or remote drive ?
Date: Mon, 15 Aug 2005 19:04:29 +0200
Lines: 39
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2180
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 82.117.212.65
Message-ID: <4300cb1d@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1124125469 82.117.212.65 (15 Aug 2005 10:04:29 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news.moat.net!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.newsfeeds.com!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail