SourceForge.net Logo
Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

EkStrings.cpp File Reference

#include <limits.h>
#include <stdlib.h>
#include "EkPrecompiled.h"
#include "EkStrings.h"

Include dependency graph for EkStrings.cpp:

Functions

void EkPutWString (ostream &stream, const wstring &ws)
 Writes a wide string to an output stream. More...

void EkGetWString (istream &stream, wstring &ws)
 Reads a wide string from an input stream. More...

wstring EkAToW (const SPmtString &str)
 Converts an ASCII string to a wide string. More...

SPmtString EkWToA (const wstring &ws, char f, const char *e)
 Converts a unicode string to ASCII. More...


Function Documentation

wstring EkAToW const SPmtString   str
 

Converts an ASCII string to a wide string.

Parameters:
str  The handle to the ASCII string to be converted
Returns:
wstring The resulting wide string

void EkGetWString istream &    stream,
wstring &    ws
 

Reads a wide string from an input stream.

Parameters:
stream  The handle to the input stream
ws  The handle to the wide string to be read into

void EkPutWString ostream &    stream,
const wstring &    ws
 

Writes a wide string to an output stream.

Parameters:
stream  The handle to the output stream
ws  The handle to the wide string to be written out

SPmtString EkWToA const wstring &    ws,
char    f = '?',
const char *    e = 0
 

Converts a unicode string to ASCII.

Parameters:
str  The handle to the ASCII string to be converted
Returns:
wstring The resulting wide string
Converts a unicode string to ASCII using operating system dependent functions, which may depend on current locale settings.

By default, any character which cannot be converted from unicode to 8-bit ASCII will be replaced by '?'. If you'd like to use a different character for these conversion failures, pass it as the second argument.

If you don't want substitution characters used when a conversion error occurs, you may pass a null-character as the second argument ('\0'). In that case, if a conversion error occurs, the conversion procedure stops and EkWTOA returns the third argument to the function as a string.

Examples:

      EkWTOA (L"ABC")                           returns the string "ABC"
      EkWTOA (L"A\400C")                        returns the string "A?C"
      EkWTOA (L"A\400C",'.')            returns the string "A.C"
      EkWTOA (L"A\400C",'\0')           returns the string ""
      EkWTOA (L"A\400C",'\0',"DARN!") returns the string "DARN!"

Last Updated: March 12, 2003 (rlr)
Copyright © 2003 Eastman Kodak Company All Rights Reserved.