---
name: "EMF_DATASTREAM"
section: "3"
platform: "linux"
package: "libemf-doc"
version: "1.0.13-8"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/EMF_DATASTREAM"
---

# EMF\_DATASTREAM(3)

Support different endian modes when reading and writing the metafile.

## NAME

EMF::DATASTREAM - Support different endian modes when reading and writing the metafile.

## SYNOPSIS

`#include <libemf.h>`

### Public Member Functions

**DATASTREAM** (::FILE \*fp=0)\
 void **setStream** (::FILE \*fp)\
 **DATASTREAM** & **operator\<\<** (const BYTE &byte)\
 **DATASTREAM** & **operator\>\>** (BYTE &byte)\
 **DATASTREAM** & **operator\<\<** (const WORD &word)\
 **DATASTREAM** & **operator\>\>** (WORD &word)\
 **DATASTREAM** & **operator\<\<** (const INT16 &word)\
 **DATASTREAM** & **operator\>\>** (INT16 &word)\
 **DATASTREAM** & **operator\<\<** (const DWORD &dword)\
 **DATASTREAM** & **operator\>\>** (DWORD &dword)\
 **DATASTREAM** & **operator\<\<** (const LONG &long\_)\
 **DATASTREAM** & **operator\>\>** (LONG &long\_)\
 **DATASTREAM** & **operator\<\<** (const INT &int\_)\
 **DATASTREAM** & **operator\>\>** (INT &int\_)\
 **DATASTREAM** & **operator\<\<** (const UINT &uint)\
 **DATASTREAM** & **operator\>\>** (UINT &uint)\
 **DATASTREAM** & **operator\<\<** (const FLOAT &float\_)\
 **DATASTREAM** & **operator\>\>** (FLOAT &float\_)\
 **DATASTREAM** & **operator\<\<** (const **PADDING** &padding)\
 **DATASTREAM** & **operator\<\<** (const RECTL &rectl)\
 **DATASTREAM** & **operator\>\>** (RECTL &rectl)\
 **DATASTREAM** & **operator\<\<** (const SIZEL &sizel)\
 **DATASTREAM** & **operator\>\>** (SIZEL &sizel)\
 **DATASTREAM** & **operator\<\<** (const **WCHARSTR** &wcharstr)\
 **DATASTREAM** & **operator\>\>** (**WCHARSTR** &wcharstr)\
 **DATASTREAM** & **operator\<\<** (const **CHARSTR** &charstr)\
 **DATASTREAM** & **operator\>\>** (**CHARSTR** &charstr)\
 **DATASTREAM** & **operator\<\<** (const ::EMR &emr)\
 **DATASTREAM** & **operator\>\>** (::EMR &emr)\
 **DATASTREAM** & **operator\<\<** (const POINT &point)\
 **DATASTREAM** & **operator\>\>** (POINT &point)\
 **DATASTREAM** & **operator\<\<** (const POINTL &pointl)\
 **DATASTREAM** & **operator\>\>** (POINTL &pointl)\
 **DATASTREAM** & **operator\<\<** (const POINT16 &point)\
 **DATASTREAM** & **operator\>\>** (POINT16 &point)\
 **DATASTREAM** & **operator\<\<** (const XFORM &xform)\
 **DATASTREAM** & **operator\>\>** (XFORM &xform)\
 **DATASTREAM** & **operator\<\<** (const **BYTEARRAY** &array)\
 **DATASTREAM** & **operator\>\>** (**BYTEARRAY** &array)\
 **DATASTREAM** & **operator\<\<** (const **POINTLARRAY** &array)\
 **DATASTREAM** & **operator\>\>** (**POINTLARRAY** &array)\
 **DATASTREAM** & **operator\<\<** (const **POINT16ARRAY** &array)\
 **DATASTREAM** & **operator\>\>** (**POINT16ARRAY** &array)\
 **DATASTREAM** & **operator\<\<** (const **INTARRAY** &array)\
 **DATASTREAM** & **operator\>\>** (**INTARRAY** &array)\
 **DATASTREAM** & **operator\<\<** (const **DWORDARRAY** &array)\
 **DATASTREAM** & **operator\>\>** (**DWORDARRAY** &array)\
 **DATASTREAM** & **operator\<\<** (const ::EMRTEXT &text)\
 **DATASTREAM** & **operator\>\>** (::EMRTEXT &text)\
 **DATASTREAM** & **operator\<\<** (const LOGPEN &pen)\
 **DATASTREAM** & **operator\>\>** (LOGPEN &pen)\
 **DATASTREAM** & **operator\<\<** (const EXTLOGPEN &pen)\
 **DATASTREAM** & **operator\>\>** (EXTLOGPEN &pen)\
 **DATASTREAM** & **operator\<\<** (const LOGBRUSH &brush)\
 **DATASTREAM** & **operator\>\>** (LOGBRUSH &brush)\
 **DATASTREAM** & **operator\<\<** (const LOGFONTW &font)\
 **DATASTREAM** & **operator\>\>** (LOGFONTW &font)\
 **DATASTREAM** & **operator\<\<** (const PANOSE &panose)\
 **DATASTREAM** & **operator\>\>** (PANOSE &panose)\
 **DATASTREAM** & **operator\<\<** (const EXTLOGFONTW &font)\
 **DATASTREAM** & **operator\>\>** (EXTLOGFONTW &font)\
 **DATASTREAM** & **operator\<\<** (const LOGPALETTE &palette)\
 **DATASTREAM** & **operator\>\>** (LOGPALETTE &palette)\

## Detailed Description

Support different endian modes when reading and writing the metafile.

To support different endian modes, rather than just writing the structures directly to a file via fwrite( &emr, ...), we have to write each element of the structure separately, swapping bytes as necessary. datastream supports this. Remarkably similar to the QDataStream class from Qt. So, too, for reading.

## Constructor & Destructor Documentation

### EMF::DATASTREAM::DATASTREAM (::FILE \* fp = `0`)` [inline]`

Constructor for **DATASTREAM**.

**Parameters**

*fp* optional file pointer (but must be assigned before any output occurs.)

## Member Function Documentation

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const ::EMR & emr)` [inline]`

Output an Enhanced Metafile Record header.

**Parameters**

*emr* Enhanced Metafile Record header to output.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const ::EMRTEXT & text)` [inline]`

Output an Enhanced Metafile Text Record.

**Parameters**

*text* Enhanced Metafile Text Record to output.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const BYTE & byte)` [inline]`

Output a byte to the stream (not swabbed or anything).

**Parameters**

*byte* byte to output.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const BYTEARRAY & array)` [inline]`

Output an array of BYTEs.

**Parameters**

*array* array of BYTEs to output.

References **EMF::BYTEARRAY::array\_**, and **EMF::BYTEARRAY::n\_**.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const CHARSTR & charstr)` [inline]`

Output a single byte character string.

**Parameters**

*charstr* structure to output.

References **EMF::CHARSTR::length\_**, and **EMF::CHARSTR::string\_**.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const DWORD & dword)` [inline]`

Output a double word (long) to the stream (swabbed).

**Parameters**

*dword* double word (long) to output.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const DWORDARRAY & array)` [inline]`

Output an array of double words (longs).

**Parameters**

*array* array of double words (longs) to output.

References **EMF::DWORDARRAY::dwords\_**, and **EMF::DWORDARRAY::n\_**.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const EXTLOGFONTW & font)` [inline]`

Output an Extended Logical Font definition (using WCHAR strings).

**Parameters**

*font* Extended Logical Font definition to output.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const EXTLOGPEN & pen)` [inline]`

Output an Extended Logical Pen definition.

**Parameters**

*pen* Extended Logical Pen definition to output.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const FLOAT & float\_)` [inline]`

Output a single precision float to the stream (swabbed).

**Parameters**

*float\_* single precision float to output.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const INT & int\_)` [inline]`

Output a (long) int to the stream (swabbed).

**Parameters**

*int\_* (long) int to output.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const INT16 & word)` [inline]`

Output a (short, 16-bit) word to the stream (swabbed).

**Parameters**

*word* (short, 16-bit) word to output.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const INTARRAY & array)` [inline]`

Output an array of (long) ints.

**Parameters**

*array* array of (long) ints to output.

References **EMF::INTARRAY::ints\_**, and **EMF::INTARRAY::n\_**.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const LOGBRUSH & brush)` [inline]`

Output a Logical Brush definition.

**Parameters**

*brush* Logical Brush definition to output.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const LOGFONTW & font)` [inline]`

Output a Logical Font definition (using WCHAR strings).

**Parameters**

*font* Logical Font definition to output.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const LOGPALETTE & palette)` [inline]`

Output a Logical Palette.

**Parameters**

*palette* Logical Palette to output.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const LOGPEN & pen)` [inline]`

Output a Logical Pen definition.

**Parameters**

*pen* Logical Pen definition to output.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const LONG & long\_)` [inline]`

Output a long int to the stream (swabbed).

**Parameters**

*long\_* long int to output.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const PADDING & padding)` [inline]`

Output a series of '\\0's to pad out a record.

**Parameters**

*padding* simple padding structure (length and number of nulls).

References **EMF::PADDING::padding\_**, and **EMF::PADDING::size\_**.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const PANOSE & panose)` [inline]`

Output a Panose structure.

**Parameters**

*panose* Panose structure to output.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const POINT & point)` [inline]`

Output a POINT structure.

**Parameters**

*point* POINT to output.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const POINT16 & point)` [inline]`

Output a POINT16 structure.

**Parameters**

*point* POINT16 to output.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const POINT16ARRAY & array)` [inline]`

Output an array of POINT16s.

**Parameters**

*array* array of POINT16s to output.

References **EMF::POINT16ARRAY::n\_**, and **EMF::POINT16ARRAY::points\_**.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const POINTL & pointl)` [inline]`

Output a POINTL structure.

**Parameters**

*pointl* POINTL to output.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const POINTLARRAY & array)` [inline]`

Output an array of POINTLs.

**Parameters**

*array* array of POINTLs to output.

References **EMF::POINTLARRAY::n\_**, and **EMF::POINTLARRAY::points\_**.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const RECTL & rectl)` [inline]`

Output a RECTL structure.

**Parameters**

*rectl* structure to output.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const SIZEL & sizel)` [inline]`

Output a SIZEL structure.

**Parameters**

*sizel* structure to output.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const UINT & uint)` [inline]`

Output a (long) unsigned int to the stream (swabbed).

**Parameters**

*uint* (long) unsigned int to output.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const WCHARSTR & wcharstr)` [inline]`

Output a WCHAR string (note: the individual characters are swabbed).

**Parameters**

*wcharstr* structure to output.

References **EMF::WCHARSTR::length\_**, and **EMF::WCHARSTR::string\_**.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const WORD & word)` [inline]`

Output a (short) word to the stream (swabbed).

**Parameters**

*word* (short) word to output.

### DATASTREAM & EMF::DATASTREAM::operator\<\< (const XFORM & xform)` [inline]`

Output an XFORM structure.

**Parameters**

*xform* XFORM to output.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (::EMR & emr)` [inline]`

Input an Enhanced Metafile Record header.

**Parameters**

*emr* destination of Enhanced Metafile Record header.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (::EMRTEXT & text)` [inline]`

Input an Enhanced Metafile Text Record.

**Parameters**

*text* destination of Enhanced Metafile Text Record.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (BYTE & byte)` [inline]`

Input a byte from the stream (not swabbed or anything).

**Parameters**

*byte* destination for input byte.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (BYTEARRAY & array)` [inline]`

Input an array of BYTEs.

**Parameters**

*array* destination of array of input BYTEs.

References **EMF::BYTEARRAY::array\_**, and **EMF::BYTEARRAY::n\_**.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (CHARSTR & charstr)` [inline]`

Input a single byte character string.

**Parameters**

*charstr* destination of input CHAR string.

References **EMF::CHARSTR::length\_**, and **EMF::CHARSTR::string\_**.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (DWORD & dword)` [inline]`

Input a double word (long) from the stream (swabbed).

**Parameters**

*dword* destination for double word (long).

### DATASTREAM & EMF::DATASTREAM::operator\>\> (DWORDARRAY & array)` [inline]`

Input an array of double words (longs).

**Parameters**

*array* destination of array of input double words (longs).

References **EMF::DWORDARRAY::dwords\_**, and **EMF::DWORDARRAY::n\_**.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (EXTLOGFONTW & font)` [inline]`

Input an Extended Logical Font definition (using WCHAR strings).

**Parameters**

*font* destination of Extended Logical Font definition.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (EXTLOGPEN & pen)` [inline]`

Input an Extended Logical Pen definition.

**Parameters**

*pen* destination of Extended Logical Pen definition.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (FLOAT & float\_)` [inline]`

Input a single precision float from the stream (swabbed).

**Parameters**

*float\_* destination for single precision float.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (INT & int\_)` [inline]`

Input a (long) int from the stream (swabbed).

**Parameters**

*int\_* destination for (long) int.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (INT16 & word)` [inline]`

Input a (short, 16-bit) word from the stream (swabbed).

**Parameters**

*word* destination for (short, 16-bit) word.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (INTARRAY & array)` [inline]`

Input an array of (long) ints.

**Parameters**

*array* destination of array of input (long) ints.

References **EMF::INTARRAY::ints\_**, and **EMF::INTARRAY::n\_**.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (LOGBRUSH & brush)` [inline]`

Input a Logical Brush definition.

**Parameters**

*brush* destination of Logical Brush definition.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (LOGFONTW & font)` [inline]`

Input a Logical Font definition (using WCHAR strings).

**Parameters**

*font* destination of Logical Font definition.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (LOGPALETTE & palette)` [inline]`

Input a Logical Palette.

**Parameters**

*palette* destination of input Logical Palette.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (LOGPEN & pen)` [inline]`

Input a Logical Pen definition.

**Parameters**

*pen* destination of Logical Pen definition.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (LONG & long\_)` [inline]`

Input a long int from the stream (swabbed).

**Parameters**

*long\_* destination for long int.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (PANOSE & panose)` [inline]`

Input a Panose structure.

**Parameters**

*panose* destinatino of input Panose structure.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (POINT & point)` [inline]`

Input a POINT structure.

**Parameters**

*point* destination of input POINT.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (POINT16 & point)` [inline]`

Input a POINT16 structure.

**Parameters**

*point* destination of input POINT16.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (POINT16ARRAY & array)` [inline]`

Input an array of POINT16s.

**Parameters**

*array* destination of array of input POINT16s.

References **EMF::POINT16ARRAY::n\_**, and **EMF::POINT16ARRAY::points\_**.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (POINTL & pointl)` [inline]`

Input a POINTL structure.

**Parameters**

*pointl* destination of input POINTL.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (POINTLARRAY & array)` [inline]`

Input an array of POINTLs.

**Parameters**

*array* destination of array of input POINTLs.

References **EMF::POINTLARRAY::n\_**, and **EMF::POINTLARRAY::points\_**.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (RECTL & rectl)` [inline]`

Input a RECTL structure.

**Parameters**

*rectl* destination of input RECTL.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (SIZEL & sizel)` [inline]`

Input a SIZEL structure.

**Parameters**

*sizel* destination of input SIZEL.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (UINT & uint)` [inline]`

Input a (long) unsigned int from the stream (swabbed).

**Parameters**

*uint* destination for (long) unsigned int.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (WCHARSTR & wcharstr)` [inline]`

Input a WCHAR string (note: the individual characters are swabbed.)

**Parameters**

*wcharstr* destination of input WCHAR string.

References **EMF::WCHARSTR::length\_**, and **EMF::WCHARSTR::string\_**.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (WORD & word)` [inline]`

Input a (short) word from the stream (swabbed).

**Parameters**

*word* destination for (short) word.

### DATASTREAM & EMF::DATASTREAM::operator\>\> (XFORM & xform)` [inline]`

Input an XFORM structure.

**Parameters**

*xform* destination of input XFORM.

### void EMF::DATASTREAM::setStream (::FILE \* fp)` [inline]`

Use the given FILE stream as the input/output destination.

**Parameters**

*fp* file point for i/o.

## Author

Generated automatically by Doxygen for libemf from the source code.
