Skip to content

Commit 47c8d9f

Browse files
feat: add Print::vprintf function
This does the same as printf, but (like the vprintf libc function) accepts an already processed va_list to allow other vararg functions to forward their argument lists to this function.
1 parent 337cad1 commit 47c8d9f

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

cores/arduino/Print.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,17 @@ int Print::printf(const __FlashStringHelper *format, ...)
277277
return retval;
278278
}
279279

280+
int Print::vprintf(const char *format, va_list ap)
281+
{
282+
return vdprintf((int)this, format, ap);
283+
}
284+
285+
int Print::vprintf(const __FlashStringHelper *format, va_list ap)
286+
{
287+
return vdprintf((int)this, (const char*)format, ap);
288+
}
289+
290+
280291
// Private Methods /////////////////////////////////////////////////////////////
281292

282293
size_t Print::printNumber(unsigned long n, uint8_t base)

cores/arduino/Print.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ class Print {
106106

107107
int printf(const char *format, ...);
108108
int printf(const __FlashStringHelper *format, ...);
109+
int vprintf(const __FlashStringHelper *format, va_list ap);
110+
int vprintf(const char *format, va_list ap);
109111

110112
virtual void flush() { /* Empty implementation for backward compatibility */ }
111113
};

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy