修复了半自动测试系统读取文件过程中存在的系列问题

This commit is contained in:
2022-05-25 11:04:41 +08:00
parent 8b4b560250
commit ce65bf8ee0
5 changed files with 33 additions and 14 deletions

View File

@@ -67,7 +67,7 @@ rail_node_t *ChooseConfigFile(int index)
sprintf(case_path, "%d", index);
char file_path[30];
char file_path[30] = {0};
strcat(file_path, root_path);
strcat(file_path, case_path);
@@ -106,14 +106,15 @@ rail_node_t *ReadChosenConfigFile(char *config_file_path)
p++;
}
if (*p == '1' && *(p + 1) != '\n')
{
total_station = 10;
}
else if (*(p + 1) == '\n')
// 讲道理,应该只有两位数,所以就这样处理了
if (*(p + 1) == '\n' || *(p + 1) == '\0')
{
total_station = *p - 48;
}
else
{
total_station = (*p - 48) * 10 + *(p + 1) - 48;
}
break;
case 'S':
@@ -161,7 +162,7 @@ rail_node_t *ReadChosenConfigFile(char *config_file_path)
p++;
}
if (*(p + 1) == '\n')
if (*(p + 1) == '\n' || *(p + 1) == '\0')
{
distance = *p - 48;
}