diff --git a/CMakeLists.txt b/CMakeLists.txt index 241cdf8..9b0ebe5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,11 +2,6 @@ cmake_minimum_required(VERSION 3.15) project(HelloWorld) -# gstreamer-1.0 -find_package(PkgConfig REQUIRED) -pkg_check_modules(GST REQUIRED gstreamer-1.0) -include_directories(${GST_INCLUDE_DIRS}) - set(CMAKE_CXX_STANDARD 14) set (source_dir "./src") diff --git a/example.txt b/example.txt new file mode 100644 index 0000000..aebd84c --- /dev/null +++ b/example.txt @@ -0,0 +1 @@ +this is a test baby diff --git a/src/Main b/src/Main deleted file mode 100755 index 636dc7e..0000000 Binary files a/src/Main and /dev/null differ diff --git a/src/Main.cpp b/src/Main.cpp index 816d86f..2885523 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -1,11 +1,37 @@ -#include +#include -#include +#include +#include -int main() -{ +std::string read_line(std::string file_path) { + // Create an ifstream object and associate it with the file "example.txt". + std::ifstream infile(file_path); + + // If the file could not be opened, print an error message and exit the + // program. + if (!infile.is_open()) { + std::cerr << "Error: Could not open file " << file_path << std::endl; + return ""; + } + + // Read a line of text from the file. + std::string line; + std::getline(infile, line); + + // Print the line of text to the console. + std::cout << "The first line of the file is:\n"; + std::cout << line << std::endl; + + // Close the file. + infile.close(); + + return line; +} + +int main() { std::cout << "Hello World!" << std::endl; - std::cin.get(); + std::string line = read_line("../example.txt"); + return 0; }