我收到警告:忽略 'getcwd' 的返回值,在运行此代码时使用属性 warn_unused_result #define get_current_dirr 声明:
#define get_current_dir getcwd
FILE *open_particle_data()
{
FILE *data_file;
char data_file_name[] = "particle_data.txt";
char buff[FILENAME_MAX];
get_current_dir(buff, FILENAME_MAX);
char *output_dir;
char str1[] = "/output_data/";
output_dir = malloc(strlen(buff) + strlen(str1) + strlen(data_file_name) + 1);
strcpy(output_dir, buff);
strcat(output_dir, str1);
strcat(output_dir, data_file_name);
data_file = fopen(output_dir,"w");
free(output_dir);
return data_file;
任何帮助,将不胜感激。谢谢