c语言中direct.h 目录操作的几个函数(Windows 版)

时间:2020-11-28 23:40:19
#include <direct.h>
#include <stdlib.h>
#include <stdio.h>

int main( void )
{
    char* buffer;

    // Get the current working directory: 
    if( (buffer = _getcwd( NULL, 0 )) == NULL )
        perror( "_getcwd error" );
    else
    {
        printf( "%s \nLength: %d\n", buffer, strnlen(buffer) );
        free(buffer);
    }
}


int _chdir( 
   const char *dirname 
);
int _wchdir( 
   const wchar_t *dirname 
);

int _rmdir(
   const char *dirname 
);
int _wrmdir(
   const wchar_t *dirname 
);

int system(
   const char *command 
);
int _wsystem(
   const wchar_t *command 
);