From 9b2706ed812b164ece72d88c12451977db73a7ec Mon Sep 17 00:00:00 2001 From: "Simon V. Lejel" Date: Sat, 10 Feb 2024 14:25:24 +0100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20toString=20to=20Messages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/main.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/client/main.cc b/src/client/main.cc index 552bf17..6cb56da 100644 --- a/src/client/main.cc +++ b/src/client/main.cc @@ -10,8 +10,12 @@ using std::cout, std::cin, std::endl, std::string; int main() { struct Message { - char * content; + string content; string username; + + string toString() { + return "User '" + username + "' wrote:\n" + content; + } }; int clientSocket = socket(AF_INET, SOCK_STREAM, 0);