×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    23

    help needed......

    I have the following codes in my program to write data to file and read from file......

    _LIT(KTestFile,"C:\\System\\apps\\testdata\\testdata.dat");
    const TUint8* KTestData=_S8("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ\n");
    const TInt KTestLength=36;
    const TPtrC8 KTestDes(KTestData,KTestLength);


    TBuf8<KTestLength+1> buf;
    RFs TheFs;
    RFile file;

    User::LeaveIfError(TheFs.Connect());
    User::LeaveIfError(file.Open(TheFs,KTestFile,EFileWrite));
    RFile f=file;
    RFileWriteStream out(f);
    out.WriteL(KTestDes);
    out.CommitL();

    TInt iFileSize;
    file.Size(iFileSize); // get the size of the file
    out.Attach(file, iFileSize);
    out.WriteL(KTestDes);
    out.Close();

    User::LeaveIfError(file.Open(TheFs,KTestFile,EFileRead));
    RFile f=file;
    RFileReadStream in(f);
    in.ReadL(buf);
    in.Close();
    TheFs.Close();


    Anyone know how to display the data inside the file on the screen if I want to?


    million thanks in advance.......
    Last edited by joanntsc; 2003-10-07 at 09:56.

  2. #2
    Regular Contributor
    Join Date
    Aug 2003
    Location
    Italy
    Posts
    54
    Add this line in cpp file:

    include <utf.h>

    and this line in the mmp file:

    LIBRARY charconv.lib

    =|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|

    After this line in your cpp file:

    in.ReadL(buf);

    write:

    PrintOnScreen(buf)

    now in your cpp file create this:

    void CYourClassName::PrintOnScreen(TDes8& buf)
    {
    CnvUtfConverter::ConvertToUnicodeFromUtf8(text,buf);
    iLog.LogL(text);
    }

    =|=|=|=|=|=|=|=|=|=|=|=|=|=|=|=|

    Of course you need to inizialize iLog function in your project.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×