mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-28 03:09:24 +08:00
62 lines
1.6 KiB
C++
62 lines
1.6 KiB
C++
|
|
#include <Windows.h>
|
|||
|
|
|
|||
|
|
#include <QApplication>
|
|||
|
|
#include <QtWebEngineWidgets/QtWebEngineWidgets>
|
|||
|
|
#include <filesystem>
|
|||
|
|
|
|||
|
|
#include "widgets/MainWindow.h"
|
|||
|
|
#include "common/Utils.h"
|
|||
|
|
#include "app/Application.h"
|
|||
|
|
#include "app/Dao.h"
|
|||
|
|
|
|||
|
|
int main(int argc, char** argv)
|
|||
|
|
{
|
|||
|
|
SetConsoleOutputCP(CP_UTF8); // 设置控制台输出为UTF-8
|
|||
|
|
|
|||
|
|
auto& mysqlOptions = DaoEntity::mysqlOptions();
|
|||
|
|
mysqlOptions.host = "localhost";
|
|||
|
|
mysqlOptions.port = 3306;
|
|||
|
|
mysqlOptions.user = "root";
|
|||
|
|
mysqlOptions.password = "123456";
|
|||
|
|
mysqlOptions.dbname = "ees";
|
|||
|
|
|
|||
|
|
|
|||
|
|
std::string filename = "assets/html/data中文.txt";
|
|||
|
|
|
|||
|
|
std::filesystem::path filePath = std::filesystem::u8path("assets/html/data中文.txt");
|
|||
|
|
//std::locale::global(locale(""));//将全局区域设为操作系统默认区域
|
|||
|
|
std::ifstream ifs(filePath, std::ios::binary);
|
|||
|
|
//std::locale::global(locale("C"));//还原全局区域设定
|
|||
|
|
|
|||
|
|
if (ifs.is_open())
|
|||
|
|
{
|
|||
|
|
// 将文件指针移动到末尾获取文件大小
|
|||
|
|
ifs.seekg(0, std::ios::end);
|
|||
|
|
std::streamsize size = ifs.tellg();
|
|||
|
|
ifs.seekg(0, std::ios::beg);
|
|||
|
|
|
|||
|
|
std::string buf(size, '\0');
|
|||
|
|
ifs.read(&buf[0], size);
|
|||
|
|
std::cout << "文件内容: " << buf << std::endl;
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
std::cout << "error" << std::endl;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
// 运行后台服务
|
|||
|
|
Application::instance().init();
|
|||
|
|
|
|||
|
|
// 运行QT主窗口
|
|||
|
|
QApplication qapp(argc, argv);
|
|||
|
|
MainWindow mainWin;
|
|||
|
|
mainWin.setWindowTitle("风光储能站控制管理系统");
|
|||
|
|
mainWin.resize(1920, 1080);
|
|||
|
|
mainWin.show();
|
|||
|
|
qapp.exec();
|
|||
|
|
return 0;
|
|||
|
|
}
|