46 if (this->file) this->file =
file;
54 fprintf(stderr,
"ERROR: file name pointer is zero\n");
58 file = fopen(file_name,
"wb");
62 fprintf(stderr,
"ERROR: cannot open file '%s'\n", file_name);
66 if (setvbuf(
file,
NULL, _IOFBF, io_buffer_size) != 0)
68 fprintf(stderr,
"WARNING: setvbuf() failed with buffer size %u\n", io_buffer_size);
78 fprintf(stderr,
"ERROR: file pointer is zero\n");
85 if(_setmode( _fileno( stdout ), _O_BINARY ) == -1 )
87 fprintf(stderr,
"ERROR: cannot set stdout to binary (untranslated) mode\n");
104 return open(out, header, version);
111 fprintf(stderr,
"ERROR: ByteStreamOut pointer is zero\n");
118 fprintf(stderr,
"ERROR: LASheader pointer is zero\n");
126 fprintf(stderr,
"ERROR: bounding box (%g %g / %g %g) exceeds longitude / latitude\n", header->
min_x, header->
min_y, header->
max_x, header->
max_y);
163 if (version == 48 || version == 40 || version == 56)
169 fprintf(stderr,
"WARNING: version %d of QFIT unknown ... using 48\n", version);
177 fprintf(stderr,
"ERROR: while writing version of QFIT header\n");
186 if (!stream->
putBytes((
U8*)buffer, version-4))
188 fprintf(stderr,
"ERROR: writing first header record of QFIT header\n");
194 buffer[0] = -9000000;
199 fprintf(stderr,
"ERROR: while writing -9000000 into QFIT header\n");
204 fprintf(stderr,
"ERROR: while writing offset into QFIT header\n");
210 memset(buffer, 0, 48);
211 sprintf((
char*)buffer,
"LAStools by Martin Isenburg");
212 if (!stream->
putBytes((
U8*)buffer, version-8))
214 fprintf(stderr,
"ERROR: writing second header record of QFIT header\n");
218 memset(buffer, 0, 48);
virtual BOOL putBytes(const U8 *bytes, U32 num_bytes)=0
void ENDIAN_SWAP_32(U8 *field)
BOOL write_point(const LASpoint *point)
virtual I64 tell() const =0
I32 scan_azimuth_array_offset
I64 close(BOOL update_npoints=true)
BOOL update_header(const LASheader *header, BOOL use_inventory=TRUE, BOOL update_extra_bytes=FALSE)
virtual BOOL put32bitsLE(const U8 *bytes)=0
#define LAS_TOOLS_VERSION
BOOL open(const char *file_name, const LASheader *header, I32 version=48, U32 io_buffer_size=65536)
I32 get_extra_attribute_array_offset(const char *name) const
I32 pulse_width_array_offset
void get_extra_attribute(I32 index, U8 *data) const