blob: d79c74c048ee8e59acdbcde5e21a603560a2c503 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
// Copyright (C) 1999-2018
// 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;
}
|