summaryrefslogtreecommitdiffstats
path: root/tksao/fitsy++/outchannel.C
diff options
context:
space:
mode:
Diffstat (limited to 'tksao/fitsy++/outchannel.C')
-rw-r--r--tksao/fitsy++/outchannel.C30
1 files changed, 30 insertions, 0 deletions
diff --git a/tksao/fitsy++/outchannel.C b/tksao/fitsy++/outchannel.C
new file mode 100644
index 0000000..ca48b72
--- /dev/null
+++ b/tksao/fitsy++/outchannel.C
@@ -0,0 +1,30 @@
+// Copyright (C) 1999-2016
+// Smithsonian Astrophysical Observatory, Cambridge, MA, USA
+// For conditions of distribution and use, see copyright notice in "copyright"
+
+#include <tcl.h>
+
+#include "outchannel.h"
+
+OutFitsChannel::OutFitsChannel(Tcl_Interp* interp, const char* ch)
+{
+ int tclMode;
+ if ((ch_ = Tcl_GetChannel(interp, (char*)ch, &tclMode)))
+ valid_ = 1;
+}
+
+int OutFitsChannel::write(char* where, size_t size)
+{
+ // size_t size is unsigned
+ long long ss =size;
+ size_t rr = 0;
+ int r = 0;
+
+ do {
+ r = Tcl_Write(ch_, where+rr, (ss>B1MB) ? B1MB : ss);
+ ss -= r;
+ rr += r;
+ } while (r>0 && rr<size);
+
+ return rr;
+}