From cb834bd7932ccddb621b168d3d8be6231f21cdbf Mon Sep 17 00:00:00 2001 From: talksik Date: Tue, 3 Oct 2023 22:46:40 -0700 Subject: [PATCH] reference instead --- src/Main.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Main.cpp b/src/Main.cpp index 2885523..0f7bc61 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -3,7 +3,7 @@ #include #include -std::string read_line(std::string file_path) { +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); @@ -31,7 +31,8 @@ std::string read_line(std::string file_path) { int main() { std::cout << "Hello World!" << std::endl; - std::string line = read_line("../example.txt"); + std::string file_path = "../example.txt"; + std::string line = read_line(file_path); return 0; }