Solved

Get current directory in VC++

Posted on 2004-04-15
5
1,947 Views
Last Modified: 2007-12-19
Hi,

How to get current working directory in VC++?

Thanks in advance,
Pampa
0
Comment
Question by:pampa_analytica
5 Comments
 
LVL 7

Accepted Solution

by:
leflon earned 35 total points
ID: 10831775
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
 
LVL 16

Expert Comment

by:nonubik
ID: 10831829
0
 
LVL 2

Expert Comment

by:dxdat99
ID: 10832623
Hi!
u can use this code
----------
CString strDirName;
GetCurrentDirectory(strDirName);
----------
good luck
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now