Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: WNCInterface_M2Xdemo ATT_WNCInterface_Info WNCInterface_HTTP_example Public_IoT_M2X_Cellular_Demo
Fork of M2XStreamClient by
Diff: Print.cpp
- Revision:
- 5:ea68c8980ad8
diff -r 000000000000 -r ea68c8980ad8 Print.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Print.cpp Thu Oct 24 12:22:33 2013 +0000
@@ -0,0 +1,63 @@
+#include "Print.h"
+#include "mbed.h"
+
+#include <stdio.h>
+#include <string.h>
+
+size_t Print::write(const uint8_t* buf, size_t size) {
+ size_t ret = 0;
+ while (size--) {
+ ret += write(*buf++);
+ }
+ return ret;
+}
+
+size_t Print::print(const char* s) {
+ return write((const uint8_t*)s, strlen(s));
+}
+
+size_t Print::print(char c) {
+ return write(c);
+}
+
+size_t Print::print(int n) {
+ return print((long) n);
+}
+
+size_t Print::print(long n) {
+ char buf[8 * sizeof(long) + 1];
+ snprintf(buf, sizeof(buf), "%ld", n);
+ return print(buf);
+}
+
+// Digits are ignored for now
+size_t Print::print(double n, int digits) {
+ char buf[65];
+ snprintf(buf, sizeof(buf), "%g", n);
+ return print(buf);
+}
+
+size_t Print::println(const char* s) {
+ return print(s) + println();
+}
+
+size_t Print::println(char c) {
+ return print(c) + println();
+}
+
+size_t Print::println(int n) {
+ return print(n) + println();
+}
+
+size_t Print::println(long n) {
+ return print(n) + println();
+}
+
+size_t Print::println(double n, int digits) {
+ return print(n, digits) + println();
+}
+
+size_t Print::println() {
+ return print('\r') + print('\n');
+}
+
