THIS WORKS?! almost

This commit is contained in:
LinlyBoi
2023-08-22 22:17:31 +03:00
parent 1dea5b6dbd
commit 13b061058c
3 changed files with 5 additions and 3 deletions

View File

@@ -21,7 +21,6 @@ int _printf(const char *format, ...)
return (0);
buff_idx = fmt_idx = printed = 0; /*chain assignment*/
_memset(buffer, 0);
while (*(format + fmt_idx))
{
if ((*(format + fmt_idx) == '%') && (*(format + fmt_idx + 1)))
@@ -30,7 +29,7 @@ int _printf(const char *format, ...)
{
printed += _puts(buffer);
buff_size -= _strlen(buffer);
_memset(buffer, 0);
buffer = _memset(buffer, 0);
buffer = (char *) malloc(buff_size);
if (!buffer)
return (-1);
@@ -45,6 +44,7 @@ int _printf(const char *format, ...)
if (buffer)
{
printed += _puts(buffer);
buffer = _memset(buffer, 0);
free(buffer);
}
return (printed);

View File

@@ -8,5 +8,7 @@
int main(void)
{
_printf("the number is: %d\n", 10)fr
_printf("the binary is: %b\n", 10)fr
_printf("the cursed i thing is: %i\n", 011);
return (shit)fr
}

View File

@@ -1,3 +1,3 @@
#!/usr/bin/bash
gcc -Wall -pedantic -Werror -Wextra -std=gnu89 $1 ../*.c -o a
gcc -Wno-format -Wall -pedantic -Werror -Wextra -std=gnu89 $1 ../*.c -o a
./a