×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Regular Contributor
    Join Date
    Oct 2007
    Posts
    84

    when reading file the entire lineis not read...

    Hai,

    while reading from this file

    RFileReadStream inputFileStream(rFile);
    CleanupClosePushL(inputFileStream);

    // HBufC descriptor is created from the RFileStream object.

    HBufC* fileData = HBufC::NewLC(inputFileStream, 1000);
    its reading only till 0\tKAUP\t980(from the file)

    data in file contains
    0\tKAUP\t980\t1.5\t10:12\t0
    1\tLAIS\t540\t1.2\t11:21\t0

    Secondly
    How can i convert this HBuf* to TBuf?

    pls,help me regarding this asap.
    Thanks in Advance

  2. #2
    Super Contributor
    Join Date
    Jun 2006
    Location
    India
    Posts
    3,037

    Re: when reading file the entire lineis not read...

    reading file in stream mode its depend on how the file was written through write stream.

    HBuf to TBuf you can find the Des() of HBuf and copy to TBuf

    hope this will helpful to you
    Use [URL="http://qt.nokia.com/products/qt-quick/"]Qt-Quick[/URL] to make your application UI more attractive.

    [URL="http://store.ovi.com/content/271896"]http://store.ovi.com/content/271896[/URL] | [URL="http://store.ovi.com/content/276199"]http://store.ovi.com/content/276199[/URL] |[URL="http://store.ovi.com/content/276202"] http://store.ovi.com/content/276202[/URL] | [URL="http://store.ovi.com/content/280827"]http://store.ovi.com/content/280827[/URL]

  3. #3
    Regular Contributor
    Join Date
    Oct 2007
    Location
    Coimbatore,India
    Posts
    114

    Re: when reading file the entire lineis not read...

    Quote Originally Posted by Rajani_sp View Post


    How can i convert this HBuf* to TBuf?
    Hi,
    check this link
    http://wiki.forum.nokia.com/index.ph...t_HBuf_to_TBuf

  4. #4
    Regular Contributor
    Join Date
    Oct 2007
    Posts
    84

    Re: when reading file the entire lineis not read...

    Thanks a lot. HBuf to TBuf is clear for me..


    Could you please give me code snippet for this...
    reading file in stream mode its depend on how the file was written through write stream.

  5. #5
    Regular Contributor
    Join Date
    Oct 2007
    Location
    Coimbatore,India
    Posts
    114

    Re: when reading file the entire lineis not read...

    Quote Originally Posted by Rajani_sp View Post

    Could you please give me code snippet for this...
    reading file in stream mode its depend on how the file was written through write stream.
    Can you tell us, how you've created the "rfile" and how you've placed the content in it(by code)?

  6. #6
    Super Contributor
    Join Date
    Jun 2006
    Location
    India
    Posts
    3,037

    Re: when reading file the entire lineis not read...

    Quote Originally Posted by Rajani_sp View Post
    Thanks a lot. HBuf to TBuf is clear for me..


    Could you please give me code snippet for this...
    reading file in stream mode its depend on how the file was written through write stream.
    //Save the data of the class to disk
    void SaveToDiskL()
    {
    //open a file server session( use the one opened at application startup )
    //new on is opened for testing only
    RFs fs;
    User::LeaveIfError(fs.Connect());
    CleanupClosePushL(fs);

    //open the stream
    RFileWriteStream writer;
    writer.PushL();
    TInt err = writer.Replace(fs,aFileName,EFileWrite);
    if(err==KErrNone)
    {
    //write the variables to stream
    writer << (TInt32)iActivate;
    writer << iVersion;
    writer << iActivationCode;

    writer.CommitL();
    }

    writer.Pop();
    writer.Release();
    CleanupStack::PopAndDestroy();
    }

    ReadFromDiskL(TDes& aFileName, TBool& aActive, TDes& aVersionType, TInt32& aVersionCode)
    {
    //open a file server session( use the one opened at application startup )
    //new on is opened for testing only
    RFs fs;
    User::LeaveIfError(fs.Connect());
    CleanupClosePushL(fs);

    //open the stream
    RFileReadStream reader;
    reader.PushL();
    TInt err = reader.Open(fs,aFileName,EFileRead);
    if(err==KErrNone)
    {
    //write the variables to stream
    TInt32 active ;

    reader >> active;
    reader >> iVersion;
    reader >> iActivationCode;

    aActive=active;


    aActive = active;
    aVersionType.Copy(iVersion);
    aVersionCode = iActivationCode;
    }

    reader.Pop();
    reader.Release();
    CleanupStack::PopAndDestroy();
    }


    may be this will help you
    Use [URL="http://qt.nokia.com/products/qt-quick/"]Qt-Quick[/URL] to make your application UI more attractive.

    [URL="http://store.ovi.com/content/271896"]http://store.ovi.com/content/271896[/URL] | [URL="http://store.ovi.com/content/276199"]http://store.ovi.com/content/276199[/URL] |[URL="http://store.ovi.com/content/276202"] http://store.ovi.com/content/276202[/URL] | [URL="http://store.ovi.com/content/280827"]http://store.ovi.com/content/280827[/URL]

  7. #7
    Regular Contributor
    Join Date
    Oct 2007
    Posts
    84

    Re: when reading file the entire lineis not read...

    This while writing in your code open in binary mode ( by default if you say EFileWrite opens in binarymode ?? ).

    If i have to wirte this data

    0\tKAUP\t980\t1.5\t10:12\t0
    1\tLAIS\t540\t1.2\t11:21\t0

    Can i use
    writer << KText ; // KText = 0\tKAUP\t980\t1.5\t10:12\t0
    and also i am not using CommitL in my code. Is this necessary..

    Thanks

  8. #8
    Super Contributor
    Join Date
    Jun 2006
    Location
    India
    Posts
    3,037

    Re: when reading file the entire lineis not read...

    Quote Originally Posted by Rajani_sp View Post
    This while writing in your code open in binary mode ( by default if you say EFileWrite opens in binarymode ?? ).

    If i have to wirte this data

    0\tKAUP\t980\t1.5\t10:12\t0
    1\tLAIS\t540\t1.2\t11:21\t0

    Can i use
    writer << KText ; // KText = 0\tKAUP\t980\t1.5\t10:12\t0
    and also i am not using CommitL in my code. Is this necessary..

    Thanks
    i am not sure you can try for this and i hope this will work fine
    Use [URL="http://qt.nokia.com/products/qt-quick/"]Qt-Quick[/URL] to make your application UI more attractive.

    [URL="http://store.ovi.com/content/271896"]http://store.ovi.com/content/271896[/URL] | [URL="http://store.ovi.com/content/276199"]http://store.ovi.com/content/276199[/URL] |[URL="http://store.ovi.com/content/276202"] http://store.ovi.com/content/276202[/URL] | [URL="http://store.ovi.com/content/280827"]http://store.ovi.com/content/280827[/URL]

  9. #9
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,674

    Re: when reading file the entire lineis not read...

    Also note what RWriteStream and RReadStream do with descriptors. The default behavior when reading is that RReadStream fills the given descriptor, which may or may not be what you want exactly.

Similar Threads

  1. Replies: 15
    Last Post: 2007-10-24, 13:47
  2. Error with makesis.exe and creating the .pkg file
    By gramya87 in forum Symbian Tools & SDKs
    Replies: 7
    Last Post: 2007-10-10, 13:53
  3. Contacts fields order??
    By timatima in forum Symbian
    Replies: 1
    Last Post: 2007-06-08, 13:51
  4. read string from text file problem
    By sim.sim in forum Symbian
    Replies: 9
    Last Post: 2006-05-24, 07:41
  5. Reading a .txt file from jar without knowing the size of the file !
    By ionutianasi in forum Mobile Java General
    Replies: 12
    Last Post: 2004-06-24, 00:27

Posting Permissions

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