#include<iostream>
#include<string.h>
#include<cstdio>
int main()
{
char path[]="~/tmp.txt";
FILE* fp=fopen(path,"at");
fputs("success\n",fp);
fclose(fp);
std::cout<<"success"<<std::endl;
return 0;
}
这段代码运行出错,因为c不能识别“~”,要补全绝对路径!!!