mmioStringToFOURCC
Appearance
The mmioStringToFOURCC function converts a null-terminated string to a four-character code (FOURCC).
Syntax
#define INCL_MMIOOS2 #include <os2.h> FOURCC mmioStringToFOURCC(PSZ pszString, USHORT usFlags);
Parameters
- pszString (PSZ) - input
- The null-terminated string to convert to a FOURCC.
- usFlags (USHORT) - input
- Specifies options for the conversion. Contains 0 or the following flag:
- MMIO_TOUPPER: Converts all characters in the resulting four-character code to uppercase.
Return Value
- rc (FOURCC) - returns
- Returns the four-character code created from the string.
Remarks
This function is a utility to simplify the creation of FOURCC identifiers from strings. It does not validate whether the characters in pszString follow specific naming conventions.
The function handles string length as follows:
- If the string is shorter than four characters, it is copied and padded with blanks (spaces) to the right to fill the 4-byte FOURCC.
- If the string is longer than four characters, it is truncated to the first four characters.
Example Code
The following code illustrates how to convert the string "IMG" into an uppercase FOURCC. Because "IMG" is only three characters, the resulting FOURCC will be "IMG ".
FOURCC fcc;
...
fcc = mmioStringToFOURCC("IMG", MMIO_TOUPPER);
if (!fcc)
{
/* error */
}
else
{
/* fcc now contains the FOURCC for 'IMG ' */
}
...