Working on width & flags with %s
This commit is contained in:
parent
a632729214
commit
6e8d779d57
1 changed files with 37 additions and 1 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: lalgarra <lalgarra@student.42madrid.com> +#+ +:+ +#+ */
|
/* By: lalgarra <lalgarra@student.42madrid.com> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2025/10/15 18:54:32 by lalgarra #+# #+# */
|
/* Created: 2025/10/15 18:54:32 by lalgarra #+# #+# */
|
||||||
/* Updated: 2025/10/19 22:18:48 by lalgarra ### ########.fr */
|
/* Updated: 2025/10/20 19:30:05 by lalgarra ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -180,6 +180,40 @@ static void test08()
|
||||||
ft_printf("ret=%i\n", ret);
|
ft_printf("ret=%i\n", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test09()
|
||||||
|
{
|
||||||
|
char prefix[128];
|
||||||
|
char sfmt[128];
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
strcpy(prefix, "test09: ");
|
||||||
|
strcpy(sfmt, "%%1s, %%-1s, %%-2s %1s, %-1s, %-2s --eof; ");
|
||||||
|
printf("%s printf(): ", prefix);
|
||||||
|
ret = printf(sfmt, "", "", "");
|
||||||
|
printf("ret=%i\n", ret);
|
||||||
|
fflush(stdout);
|
||||||
|
ft_printf("%sft_printf(): ", prefix);
|
||||||
|
ret = ft_printf(sfmt, "", "", "");
|
||||||
|
ft_printf("ret=%i\n", ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test10()
|
||||||
|
{
|
||||||
|
char prefix[128];
|
||||||
|
char sfmt[128];
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
strcpy(prefix, "test10: ");
|
||||||
|
strcpy(sfmt, "%%.2s %%.3s %%.4s %%.5s %%.1s: %.2s %.3s %.4s %.5s %.1s--eof; ");
|
||||||
|
printf("%s printf(): ", prefix);
|
||||||
|
ret = printf(sfmt, " - ", "", "4", "", "2 ");
|
||||||
|
printf("ret=%i\n", ret);
|
||||||
|
fflush(stdout);
|
||||||
|
ft_printf("%sft_printf(): ", prefix);
|
||||||
|
ret = ft_printf(sfmt, " - ", "", "4", "", "2 ");
|
||||||
|
ft_printf("ret=%i\n", ret);
|
||||||
|
}
|
||||||
|
|
||||||
static void test50()
|
static void test50()
|
||||||
{
|
{
|
||||||
char prefix[128];
|
char prefix[128];
|
||||||
|
|
@ -224,6 +258,8 @@ int main(void)
|
||||||
test06();
|
test06();
|
||||||
test07();
|
test07();
|
||||||
test08();
|
test08();
|
||||||
|
test09();
|
||||||
|
test10();
|
||||||
test50();
|
test50();
|
||||||
test99();
|
test99();
|
||||||
return (0);
|
return (0);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue