C语言中有用的函数


1,getcwd

可以获得当前程序的运行路径

#include <stdio.h>
#include "stdlib.h"
#include "direct.h"
#include <string.h>

#define MAXPATH 250

int main(void)
{
	char buffer[MAXPATH];
	getcwd(buffer, MAXPATH);
	printf("The current directory is: %s\n", buffer);
	char relative_path[] ="/data/in.txt";
	strcat( buffer, relative_path);
	printf("The current directory is: %s\n", buffer);
	char command[MAXPATH] = "start ";
	strcat( command, buffer );
	system( command );
	return 0;
}


你可能感兴趣的:(C语言中有用的函数)