cpp: Eliminate the use of fprintf [THRIFT-77]

Add printf and perror methods to TOutput and use them to
replace uses of fprintf in the C++ library.


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@676448 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/Thrift.h b/lib/cpp/src/Thrift.h
index 4d2ff20..bb2b14a 100644
--- a/lib/cpp/src/Thrift.h
+++ b/lib/cpp/src/Thrift.h
@@ -38,6 +38,17 @@
     f_(message);
   }
 
+  // It is important to have a const char* overload here instead of
+  // just the string version, otherwise errno could be corrupted
+  // if there is some problem allocating memory when constructing
+  // the string.
+  void perror(const char *message, int errno_copy);
+  inline void perror(const std::string &message, int errno_copy) {
+    perror(message.c_str(), errno_copy);
+  }
+
+  void printf(const char *message, ...);
+
   inline static void errorTimeWrapper(const char* msg) {
     time_t now;
     char dbgtime[25];