|Top Previous Next|
Scripts > Class elements and c++ instructions > Interpreted C++ instructions > Output > Binary output
For writing variables into binary files there is a simple notation in the TextTransformer:
out << int_bin( 42 ) << double_bin( 123,456 );
out << bin( 42 ) << bin( 123.456 );
The second notation is translated into the first one automatically in the exported C++ code. In these expressions an overwritten output operator is called for temporary objects which provide the writing of the binary forms of the respective variable types.
The variable types bool, char, int, unsigned int, float and double can be written binarily in this way. string_bin writes string c_str into the output.
bool_bin( bool b )
int_bin( int i )
uint_bin( unsigned int ii )
float_bin( float f )
double_bin( double d )
char_bin( char c )
string_bin( string s )
A special case is the zero character '\0'. To write this binarily there is this besides char_bin( '\0' ) the manipulator ends.
out << ends; // writes 00
To prevent, that '\n' will be converted in "\r\n', the file should be opened in the binary mode.
Binary data are represented in the output window of the TextTransformer only mutilated.
This page belongs to the TextTransformer Documentation
|Home Content German|