C语言中有用的函数

来源:互联网 发布:余额宝委托网络理财 编辑:程序博客网 时间:2024/06/05 14:17


1,getcwd

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

#include <stdio.h>#include "stdlib.h"#include "direct.h"#include <string.h>#define MAXPATH 250int 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;}


原创粉丝点击