Stream Integer Functions

The Pstream.h header file in the Microsoft® DirectShow® base classes contains a set of stream integer functions. These functions encode an integer in a stream object as 11 Unicode™ characters followed by one Unicode space. The interface to these functions might truncate to 32 bits. Values such as (unsigned) 0x80000000 would be written as -2147483648, but would still load as 0x80000000 again through ReadInt.

ReadInt Reads a Unicode string-encoded integer from a stream.
WriteInt Writes an integer to a stream encoded as a Unicode string.

ReadInt

Stream Integer Functions

Reads an integer from an IStream.

Syntax

STDAPI_(
  int
  )ReadInt(
  IStream *pIStream,
  HRESULT &hr
  );

Parameters

pIStream
Pointer to an IStream from which the encoded integer is to be read.
hr
Reference to an HRESULT value (output).

Return Value

Returns the integer value (truncated to 32 bits), or zero if an error occurred.

Remarks

This function is a stripped-down subset of what sscanf can do (without dragging in the C run time).

The ReadInt function can be used to read the value written by WriteInt.

WriteInt

Stream Integer Functions

Writes an integer to an IStream, encoded as described in Stream Integer Functions.

Syntax

STDAPI WriteInt(
  IStream *pIStream,
  int n
  );

Parameters

pIStream
Pointer to an IStream to which the encoded integer is to be written.
n
Integer value to be written.

Return Value

Returns an HRESULT value.

Remarks

The ReadInt function can be used to read the value written by WriteInt.


Top of Page Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.