Cannot convert 'TFileStream *' to 'TMetaClass *' while encoding and decoding wit

Giganews Newsgroups
Subject: Cannot convert 'TFileStream *' to 'TMetaClass *' while encoding and decoding wit
Posted by:  julien moorrees (n…@nims.nl)
Date: Thu, 09 Sep 2004

Hi all,

I am using TIdDecoderMIME and TIdEncoderMIME from Indy 9.00.16 to encode
and decode files.

I use the following code to encode:

AnsiString TMessageCenter::getXMLDataForFile(int aFileID,int
aFilePart,int aMaxBytes) {
    AnsiString tTransmit = "";

    TFileStream *tInFile;
    tInFile=new TFileStream( AnsiString("test.txt"),fmOpenRead |
fmShareDenyNone);
    long tOffset = aMaxBytes * aFilePart;
    long newOff =  tInFile->Seek(tOffset,soFromBeginning );
    tTransmit = EncoderMIME->Encode(tInFile,aMaxBytes-1);
    return tTransmit;
}

This works great! But now I receive such encoded string, and want to
save it. I use therefore the following code, but this gives an error:

bool TIMManager::writeEncodedstringToFile(int aFileID,int aFilePart,int
aMaxBytes, AnsiString aEncodedstring) {

    TFileStream *tOutFile;
    tOutFile=new TFileStream( AnsiString("output.txt"),fmOpenWrite |
fmShareDenyNone);
    long tOffset = aMaxBytes * aFilePart;
    long newOff =  tOutFile->Seek(tOffset,soFromBeginning );

    //Save to disk
    DecoderMIME->DecodeString(tOutFile,aEncodedstring);

    return true;
}

---- The error the compiler gives is:
Cannot convert 'TFileStream *' to 'TMetaClass *'

So I am wondering, how to get this TMetaClass into a stream?

Replies