Null character is now counted as printed character for the purposes of padding.
authorLukas Jiriste <ljiriste@student.42prague.com>
Wed, 27 Sep 2023 13:52:34 +0000 (15:52 +0200)
committerLukas Jiriste <ljiriste@student.42prague.com>
Wed, 27 Sep 2023 13:52:34 +0000 (15:52 +0200)
padding.c

index 2551dfbb65192966849d505c099d6e00db0ac863..8f5278f6f3bdf693c24f9df9e59cad12c647d1fc 100644 (file)
--- a/padding.c
+++ b/padding.c
@@ -6,7 +6,7 @@
 /*   By: ljiriste <marvin@42.fr>                    +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2023/09/05 11:25:46 by ljiriste          #+#    #+#             */
-/*   Updated: 2023/09/08 17:19:54 by ljiriste         ###   ########.fr       */
+/*   Updated: 2023/09/27 15:16:21 by ljiriste         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -56,7 +56,7 @@ void  create_padding(t_to_print *tp, t_conv conv)
 {
        size_t  len;
 
-       len = ft_strlen(tp->main_part);
+       len = ft_strlen(tp->main_part) + (!tp->main_part[0] && conv.type == 'c');
        if (conv.type == 's' || conv.type == 'c')
                tp->zero_pad = ft_strdup("");
        else