From 5776c633707b3e7c21881191cae7035ed93a0b87 Mon Sep 17 00:00:00 2001 From: axell-brendow Date: Sun, 7 Mar 2021 14:47:50 -0300 Subject: [PATCH] =?UTF-8?q?Adiciona=20m=C3=A9todo=20para=20remover=20quebr?= =?UTF-8?q?as=20de=20linha?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tps/fonte/musica.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tps/fonte/musica.cpp b/tps/fonte/musica.cpp index 419e10f..336e34a 100644 --- a/tps/fonte/musica.cpp +++ b/tps/fonte/musica.cpp @@ -1,3 +1,4 @@ +#include typedef struct { char id[30]; char name[200]; @@ -23,5 +24,17 @@ Musica clone_music(Musica *music) { return *music; } +char *remove_line_break(char line[]) { + int size = strlen(line); + + if (line[size - 2] == '\r') + line[size - 2] = '\0'; + + else if (line[size - 1] == '\r' || line[size - 1] == '\n') + line[size - 1] = '\0'; + + return line; +} + }