首页 > 解决方案 > fopen() 以路径为变量

问题描述

试图以相对路径打开文件,路径每次都不一样,我想用一个字符作为路径

目前我有:

char path[128];
strcat(path, "/home/pi/Analyses/");
strcat(path, lstAnalyse);
strcat(path, "/data.txt");
fopen(path, "a");

使用 char 作为 fopen 路径的正确方法是什么?

标签: c

解决方案


推荐阅读