mbed library sources. Supersedes mbed-src.

Fork of mbed-dev by mbed official

Files at this revision

API Documentation at this revision

Comitter:
mbed_official
Date:
Thu Nov 26 10:15:10 2015 +0000
Parent:
27:affb46b27b47
Child:
29:d3245924094c
Commit message:
Synchronized with git revision f4b1d30ff45529ee5c6aa689a35962e8d4a2ad9a

Full URL: https://github.com/mbedmicro/mbed/commit/f4b1d30ff45529ee5c6aa689a35962e8d4a2ad9a/

Enhance stream class

Changed in this revision

api/Stream.h Show annotated file Show diff for this revision Revisions of this file
common/Stream.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/api/Stream.h	Thu Nov 26 10:00:10 2015 +0000
+++ b/api/Stream.h	Thu Nov 26 10:15:10 2015 +0000
@@ -18,6 +18,7 @@
 
 #include "platform.h"
 #include "FileLike.h"
+#include <cstdarg>
 
 namespace mbed {
 
@@ -37,6 +38,8 @@
     char *gets(char *s, int size);
     int printf(const char* format, ...);
     int scanf(const char* format, ...);
+    int vprintf(const char* format, std::va_list args);
+    int vscanf(const char* format, std::va_list args);
 
     operator std::FILE*() {return _file;}
 
--- a/common/Stream.cpp	Thu Nov 26 10:00:10 2015 +0000
+++ b/common/Stream.cpp	Thu Nov 26 10:15:10 2015 +0000
@@ -15,8 +15,6 @@
  */
 #include "Stream.h"
 
-#include <cstdarg>
-
 namespace mbed {
 
 Stream::Stream(const char *name) : FileLike(name), _file(NULL) {
@@ -108,4 +106,16 @@
     return r;
 }
 
+int Stream::vprintf(const char* format, std::va_list args) {
+    fflush(_file);
+    int r = vfprintf(_file, format, args);
+    return r;
+}
+
+int Stream::vscanf(const char* format, std::va_list args) {
+    fflush(_file);
+    int r = vfscanf(_file, format, args);
+    return r;
+}
+
 } // namespace mbed