From a981f9dc3de3781202b926fabf9107cb4966206f Mon Sep 17 00:00:00 2001 From: uvos Date: Mon, 3 Apr 2023 21:17:53 +0200 Subject: [PATCH] Insure that a newline is sent --- CMakeLists.txt | 3 ++- main.cpp | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b859ce7..5ece9d7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,7 @@ add_executable(${PROJECT_NAME} ${SRC_FILES}) target_link_libraries( ${PROJECT_NAME} ${LIBS}) set_target_properties( ${PROJECT_NAME} PROPERTIES COMPILE_FLAGS -m64 LINK_FLAGS -m64) -add_definitions(" -std=c++11 -Wall ") +add_definitions("-std=c++11 -Wall") +set(CMAKE_INSTALL_PREFIX /usr) install(TARGETS serialterminal RUNTIME DESTINATION bin) diff --git a/main.cpp b/main.cpp index b99fd58..1a6ccec 100644 --- a/main.cpp +++ b/main.cpp @@ -89,9 +89,10 @@ void recvThreadFunction(int serial, int signal) break; std::this_thread::sleep_for(std::chrono::milliseconds(100)); char buffer[4096]; - int readlen = sRead(serial, buffer, 4096); + int readlen = sRead(serial, buffer, 4095); if(readlen > 0) { + buffer[readlen] = '\0'; rl_clear_visible_line(); std::cout<