Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]


How to request conversions

To convert an entire file or stream in a single step, use CConverterBase2::ConvertL() and CConverterBase2::ConvertObjectL() respectively.

Example

The following code fragment converts the contents of c:\private\12345678\file1 and places the output in c:\private\12345678\file2.

_LIT(KFromFile, "c:\\private\\12345678\\file1");
_LIT(KToFile, "c:\\private\\12345678\\file2");
converter->ConvertL(KFromFile, KToFile, NULL);

As the conversion process can take a long time, it can be useful to divide the process into multiple steps. To do this,

Example

The following example converts the contents of c:\private\12345678\file1 and places the output in c:\private\12345678\file2 in multiple steps. It assumes that conversion takes place within an active object, CMyActive, which does a conversion step in the RunL() function and reactivates the object if conversion is not complete.

void CMyActive::StartConverting()
    {
    _LIT(KFromFile, "c:\\private\\12345678\\file1");
    _LIT(KToFile, "c:\\private\\12345678\\file2");
    converter->ConvertAL(KFromFile, KToFile, NULL);
    User::RequestComplete(iStatus,KErrNone);
    SetActive();
    }

void CMyActive::RunL()
    {
    if (DoConvertL())
        {
        User::RequestComplete(iStatus,KErrNone);
        SetActive();
        }
    else
        {
        // Handle completed conversion
        }
    }