Link to home
Start Free TrialLog in
Avatar of karthikr
karthikr

asked on

Current Directory

I have a question regarding GetCurrentDirectory SDK Function. It takes two parameters one the length of hte buffer and the character string.

I wanted to know whether there are some other functions in MFC to get the current directory which can circumvent the Length parameter. Is there any way to get the Current Working directory using MFC and something which returns CString.
Avatar of naveenkohli
naveenkohli

not any as i know of...
just curious.. why you don't want to use GetCurrentDirectory..
Just set the length argumnet as MAX_FILE or you can say 255
try _getcwd() its stl, and u hand it the buffer
oops.... MAX_FILE should read as MAX_PATH .. :)

ASKER CERTIFIED SOLUTION
Avatar of psdavis
psdavis
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Oops, forgot to add that second parameter.

GetCurrentDirectory( strDirectory.GetBufferSetLength( _MAX_PATH ), _MAX_PATH );