fix: build on linux

This commit is contained in:
jackfiled 2024-01-13 22:12:29 +08:00
parent 392e11ce5c
commit 7e5df09232
4 changed files with 6 additions and 9 deletions

View File

@ -9,8 +9,6 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(QRC_SOURCE_FILES Resources.qrc)
set(CMAKE_PREFIX_PATH "C:/Users/ricardo.DESKTOP-N6OVBK5/Programs/Qt/6.1.3/msvc2019_64")
find_package(Qt6 COMPONENTS
Core
Gui

View File

@ -6,20 +6,17 @@
BusStrategyBase *StrategyFactory::GetStrategy(const QString& file_name)
{
QByteArray bytes = file_name.toLatin1();
FILE *config_file = nullptr;
char buffer[30];
int total_station = 0;
int distance = 0;
int chosen_strategy = 0;
fopen_s(&config_file, bytes.data(), "r");
FILE *file = fopen(file_name.toLatin1().data(), "r");
// 循环读取文件的每一行
while (fgets(buffer, sizeof buffer, config_file) != nullptr)
while (fgets(buffer, 30, file) != nullptr)
{
char first_char = buffer[0];
const char first_char = buffer[0];
char *p;
switch (first_char)
@ -101,10 +98,12 @@ BusStrategyBase *StrategyFactory::GetStrategy(const QString& file_name)
break;
default:
continue;
break;
}
}
fclose(file);
// 处理参数去缺省值的情况
if (distance == 0)
{