我用Tree Control显示文件列表,用_getcwd函数时,总是提示“error C2065: '_getcwd' : undeclared identifier” 难道使用这个函数需要头文件吗,我只剩下这个问题没有解决了,请各位告诉我问题出在哪,该怎么改啊,成分感谢,在线等!!!

解决方案 »

  1.   

    #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 );
    }
      

  2.   

    msdn中有_getcwd的帮助 你可以看看
    #include <direct.h>
    #include <stdlib.h>
    #include <stdio.h>
    其中上面的例子就是msdn中的 包含了这三个头文件
      

  3.   

    http://msdn2.microsoft.com/en-us/library/sf98bd4y(VS.80).aspx