• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1961
  • Last Modified:

Get current directory in VC++

Hi,

How to get current working directory in VC++?

Thanks in advance,
Pampa
0
pampa_analytica
Asked:
pampa_analytica
1 Solution
 
leflonCommented:
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now