I work with VTK data type for my outputs. As my data gets bigger and bigger, writing to ASCII takes a considerable amount of time and what I have done so far.
I need to change this in binary format, but the problem is that there are some headers in the file (see http://www.vtk.org/VTK/img/file-formats.pdf ) that need to be written in ASCII even for binary files.
Now I don’t have enough experience with binary formats, and my first attempt was to open two streams through
ofstream asciiWriter(file_name.c_str()); ofstream binWriter(file_name.c_str(), ios::app | ios::binary);
The problem is that the result seems disorganized asciiWriterand binWriternot displayed in the correct order, so I cannot process my file in ParaView. I tried using asciiWriter.flush()and binWriter.flush()when I finished writing the header / data, but that also does not help.
asciiWriter
binWriter
asciiWriter.flush()
binWriter.flush()
What should I do?
PS: I do not want to use the VTK package itself ... it is HUGE and adds to my code dependency!
, , - C. , * nix . Windows '\n' '\r' (CR), '\n' (LF), ; "\r\n" '\n'. Windows '\x1A' (Ctrl-Z, EOF) . , .
'\n'
'\r'
"\r\n"
'\x1A'
, , '\n' ( "\r\n") . , , Windows.
, (RSX-11 VMS ) , , , . . open(), fopen() .. ( ) , . .
open()
fopen()