Get current directory in VC++

Hi,

How to get current working directory in VC++?

Thanks in advance,
Pampa
pampa_analyticaAsked:
Who is Participating?
 
leflonConnect With a Mentor Commented:
Hi pampa_analytica,

on win system you can use the getcwd(..) func

#include <direct.h>
#include <stdlib.h>
#include <stdio.h>

void main( void )
{
   char buffer[_MAX_PATH];

   /* Get the current working directory: */
   if( _getcwd( buffer, _MAX_PATH ) == NULL )
      perror( "_getcwd error" );
   else
      printf( "%s\n", buffer );
}

hth
leflon
0
 
nonubikCommented:
0
 
dxdat99Commented:
Hi!
u can use this code
----------
CString strDirName;
GetCurrentDirectory(strDirName);
----------
good luck
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.