int my_printf(const char *format, ...) { t_struct_arg args; unsigned int i; unsigned int cwrite; i = 0; cwrite = 0; va_start(args.arg, format); while (format[i]) { va_start(args.arg_tmp, format); if (format[i] == CPUR && is_to_convert(format + i) != 0) { cwrite += check_print(&args, format, i, cwrite) - 1; i += is_to_convert(format + i); } else my_putchar(format[i]); cwrite += 1; va_end(args.arg_tmp); ++i; } va_end(args.arg); return ((int)cwrite); }
int my_printf(const char *format, ...) { t_struct_arg args; unsigned int i; unsigned int chars_written; i = 0; chars_written = 0; va_start(args.arg, format); while (format[i]) { va_start(args.arg_tmp, format); if (format[i] == '%' && is_to_convert(format + i) != 0) { chars_written = chars_written + organize_and_print(&args, format, i, chars_written) - 1; i = i + is_to_convert(format + i); } else my_putchar(format[i]); chars_written = chars_written + 1; va_end(args.arg_tmp); i = i + 1; } va_end(args.arg); return ((int)chars_written); }