DLT_Splitter/Src/Command_Solve.cpp

61 lines
1.7 KiB
C++

#include "Command_Solve.hpp"
#include "DLT_Utilities.hpp"
extern "C"
{
#include "windows.h"
#include "CSV_Utilities.hpp"
}
DLT_File File;
// 命令行处理
void Pre_Command_Solve(void)
{
CSV_Table CSV;
CSV.insert_column_before((unsigned)0, "First insert");
CSV.append_column("Test column");
CSV.append_column("Test column 2");
CSV.append_column("Test column 3");
CSV.insert_column_after("Test column 2", "Test insert column");
CSV.insert_column_after("Test column 3", "Test insert column after End");
CSV.insert_column_before("Test column", "Test insert column before Head");
CSV.insert_column_before("Test column", "Test insert column before Origin");
CSV.insert_cell_before("Test column 2", 0, "0");
CSV.append_cell("Test column 2", "1");
CSV.insert_cell_before("Test column 2", 0, "Insert");
CSV.insert_cell_after("Test column 3", (unsigned)0, "Insert Cell");
CSV.append_cell("Test column 3", "1");
CSV.append_cell("Test column 3", "MyWawwww,dwadawdawd");
CSV.append_cell("Test column 3", "3");
CSV.export_to_file("new.csv");
// 获取命令行
int argc;
LPWSTR *argv;
argv = CommandLineToArgvW(GetCommandLineW(), &argc);
if (argc <= 1)
return;
DLT_Type::DLT_Err err;
int size_needed = WideCharToMultiByte(CP_UTF8, 0, argv[1], -1, NULL, 0, NULL, NULL);
char *strTo = (char *)malloc(size_needed);
WideCharToMultiByte(CP_UTF8, 0, argv[1], -1, &strTo[0], size_needed, NULL, NULL);
err = File.open(strTo);
DLT_Type::DLT_Msg_Node *p_list;
File.get_msg_list(p_list);
free(strTo);
err = File.export_to_csv("test.csv");
if (err == DLT_Type::DLT_ERROR_NONE)
return;
}