TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: ALEX WALKER
from: KURT KUZBA
date: 1997-11-29 02:20:00
subject: How to find current dir?

AW>   How do you test for what the current directory the user
AW>   is using? BTW I'm using BC++ 3.1.
   The Borland getcwd() and _getdcwd() functions in BC++3.1
   works in both DOS and Windows applications.
   It should be in your online help.  ( This code is tested :)
   //   CWD_EX.CPP   PUBLIC DOMAIN
   #include    // for _getdcwd
   #include       // for getcwd
   #include 
   int main(void)
   {
     char CurrentWorkingDirectory[256] = "";
     if(getcwd(CurrentWorkingDirectory, 255))
     {
       cout <<  "On the default drive, your directory is "
           <<  CurrentWorkingDirectory << endl;
     }
     else
     {
       cout << "Default drive not responding." << endl;
     }
     if(_getdcwd(0, CurrentWorkingDirectory, 255))
     {
       cout <<  "On the default drive, your directory is "
           <<  CurrentWorkingDirectory << endl;
     }
     else
     {
       cout << "Default drive not responding." << endl;
     }
     if(_getdcwd(3, CurrentWorkingDirectory, 255))
     {
       cout <<  "On drive C, your directory is "
           <<  CurrentWorkingDirectory << endl;
     }
     else
     {
       cout << "Drive C not responding." << endl;
     }
     if(_getdcwd(4, CurrentWorkingDirectory, 255))
     {
       cout <<  "On drive D, your directory is "
           <<  CurrentWorkingDirectory << endl;
     }
     else
     {
       cout << "Drive D not responding." << endl;
     }
     return 0;
   }
> ] I will not tell my History Teacher to, "Get over it"........
---
---------------
* Origin: *YOPS ]I[* 3.1 GIG * RA/FD/FE RADist * Milwaukee, WI (1:154/750)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.