我的代码编译得很好但是当我运行它时我得到总线错误:10
void backupf(char *namelist, char *dirname)
{
char *in_filename;
char *out_filename;
char line[MAXPATHLEN];
FILE *filenames = fopen(namelist, "r");
if(filenames == NULL)
{
fprintf(stderr, "Cannot Open File\n");
exit(EXIT_FAILURE);
}
while( fgets(line, sizeof line, filenames) != NULL )
{
sprintf(in_filename, "./%s\n", line);
sprintf(out_filename, "%s/%s\n", dirname, line);
}
backup(dirname, in_filename, out_filename);
fclose(filenames);
}
它应该采用带有文件名列表的文本文件参数,然后使用该信息使用我编写的备份功能将其备份到备份目录。