rssmps
10-07-2005, 02:52 PM
I'm currently using the following code to obtain the current directory.
is there a better C++ way of doing this? is there such a thing as #include <direct>?
#include <direct.h>
char buffer[_MAX_PATH];
/* Get the current working directory: */
if( _getcwd( buffer, _MAX_PATH) == NULL)
{
cout<<( "_getcwd error on file" + filein );
exit(0);
}
else
{
path = buffer; // path is string
}
also, for compatibility between unix and win, is there anythin in C++ such as the following in Java?
System.getProperty("user.dir")
System.getProperty("file.separator")
Thanks!
is there a better C++ way of doing this? is there such a thing as #include <direct>?
#include <direct.h>
char buffer[_MAX_PATH];
/* Get the current working directory: */
if( _getcwd( buffer, _MAX_PATH) == NULL)
{
cout<<( "_getcwd error on file" + filein );
exit(0);
}
else
{
path = buffer; // path is string
}
also, for compatibility between unix and win, is there anythin in C++ such as the following in Java?
System.getProperty("user.dir")
System.getProperty("file.separator")
Thanks!