Discussion Board

Results 1 to 10 of 10
  1. #1
    Regular Contributor lokesh_kumar_s's Avatar
    Join Date
    Jan 2009
    Location
    India,Karnataka
    Posts
    432
    i am trying to read from file using RFilReadStream and getting system error -25
    i have attached the file that i want to read.
    and the code that i used to read it till end string by string is this
    Code:
    RFs aFs;
        aFs.Connect();
        RFileReadStream StartCameraStream;
        TInt fSize;
        User::LeaveIfError(StartCameraStream.Open(aFs,_L("C:\\Data\\StartCamera.txt"), EFileRead ));
        StartCameraStream.PushL();
        TStreamPos eofPos(StartCameraStream.Source()->SizeL());
        // Get the current position of file pointer.
        TStreamPos currentPos(0);
        
        // Read all TInt2’s until EOF.
        while (currentPos < eofPos)
        {
        TBuf<2000> value;
        StartCameraStream >> value;
        ShowMessage(value);
        
        /*aArray.Append(value);*/
        currentPos = StartCameraStream.Source()->TellL(MStreamBuf::ERead);
        }
        StartCameraStream.Close();
        StartCameraStream.Pop();
    i am able to read first two strings and i am getting error in third iteration

    please help
    Attached Files Attached Files
    Last edited by lokesh_kumar_s; 2009-10-07 at 10:13. Reason: attachment
    ---
    Regards
    Lokesh Kumar S.

  2. #2
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Mallorca, Holiday
    Posts
    27,683
    http://wiki.forum.nokia.com/index.php/Error_codes ?
    You are reading a 2000 character Unicode descriptor (so practically 4000 bytes) from a 181-byte file. I do not think that error code should be that surprising.
    You could try using RReadStream::ReadL(TDes8 &aDes, TChar aDelim), where aDelim could be the new line or the carriage return character.

  3. #3
    Super Contributor shafali gupta's Avatar
    Join Date
    Nov 2004
    Posts
    1,009
    -25 implies KErrEof.

    Did you check what position you are getting after every read?
    currentPos = StartCameraStream.Source()->TellL(MStreamBuf::ERead);
    Regards,
    Shafali

  4. #4
    Regular Contributor lokesh_kumar_s's Avatar
    Join Date
    Jan 2009
    Location
    India,Karnataka
    Posts
    432
    i know the error code meaning . see this is not the first time i faced this problem. i have already faced this problem i am not able to read the file using RFileReadStream using the above code. the code that i used is from one of the good Symbian book. please specify wat is the problem.
    ---
    Regards
    Lokesh Kumar S.

  5. #5
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Mallorca, Holiday
    Posts
    27,683
    FYI: I have edited the post, make sure that you have read the second part of it.

  6. #6
    Regular Contributor lokesh_kumar_s's Avatar
    Join Date
    Jan 2009
    Location
    India,Karnataka
    Posts
    432
    why RReadStream::ReadL(TDes8 &aDes, TChar aDelim)
    why not RReadStream::ReadL(TDes16 &aDes, TChar aDelim)
    ---
    Regards
    Lokesh Kumar S.

  7. #7
    Nokia Developer Moderator wizard_hu_'s Avatar
    Join Date
    Feb 2006
    Location
    Mallorca, Holiday
    Posts
    27,683
    Because your file contains 8-bit (ASCII) data, I have checked. Its length (181 bytes) also suggest that.
    If you would use 16-bit, Unicode text files, TFileText would be a more comfortable tool than RReadStream.

  8. #8
    Regular Contributor lokesh_kumar_s's Avatar
    Join Date
    Jan 2009
    Location
    India,Karnataka
    Posts
    432
    Code:
    while (currentPos < eofPos)
        {
        TBuf8<200> value8;
        TBuf<200> value;
        TBuf<20> currPosBuf;
        StartCameraStream.ReadL(value8,'\n');
        value.Copy(value8);
        value.Trim();
        
        ShowMessage(value);
        
        /*aArray.Append(value);*/
        currentPos = StartCameraStream.Source()->TellL(MStreamBuf::ERead);
        currPosBuf.Num(currentPos.Offset());
        ShowMessage(_L("currPos="));
        ShowMessage(currPosBuf);
        }
    i used the above code
    but it is showing
    i am writing it in same order
    1st iteration:"0000-00-00"
    2nd iteration:"00:00:00"
    3rd iteration:"FILENAME"
    4th iteration:"AF0000000"
    5th iteration:"P0:N
    AF00"
    6th iteration:"0000000P1:N"
    7th iteration:"P2:N
    AF00"
    8th iteration:"00000P3:N"
    9th iteration:"P4:N
    AF00"
    10th iteration:"00000P5:N"
    11th iteration:"P6:N
    AF00"
    12th iteration:"00000P7:N"
    13th iteration:"P8:N
    AF00"
    14th iteration:"00000P9:N"

    and the currentPos is increamenting in terms of 10
    from 10 to 180 like
    10
    20
    30
    40
    50
    60
    70
    80
    90
    100
    110
    120
    130
    140
    150
    160
    170
    180
    Last edited by lokesh_kumar_s; 2009-10-07 at 12:59.
    ---
    Regards
    Lokesh Kumar S.

  9. #9
    Regular Contributor lokesh_kumar_s's Avatar
    Join Date
    Jan 2009
    Location
    India,Karnataka
    Posts
    432
    i think ascii value of \n is 10 so it is simply incrementing by ten
    please specify how to get those strings by delimiting '\n'
    ---
    Regards
    Lokesh Kumar S.

  10. #10
    Regular Contributor lokesh_kumar_s's Avatar
    Join Date
    Jan 2009
    Location
    India,Karnataka
    Posts
    432
    Thanks wizard_hu_ & shafali gupta i got it right i changed
    Code:
    StartCameraStream.ReadL(value8,'\n');
    to
    Code:
    StartCameraStream.ReadL(value8,TChar('\n'));
    ---
    Regards
    Lokesh Kumar S.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved