×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Sep 2008
    Posts
    40

    How to use RFile instance to seek some bytes?

    I took a look at SDK document, but i really do not know how to use it. And I want to seek 22 bytes from the beginning of the file.

    For example: (in C#.NET)
    Code:
    //Open file using FileStream fs
    BinaryReader br = new BinaryReader(fs);
    fs.Position = 22;
    short i = br.ReadInt16();
    fs.Position = 24;
    int j = br.ReadInt32();
    Anybody helps me, please?
    Last edited by 113115; 2008-12-22 at 14:50.

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,750

    Re: How to use RFile instance to seek some bytes?

    RFile is not that complex, and actually it has a Seek method. The only difficulty that the position is a bi-directional argument (it will contain the resulting position which makes sense if you are seeking backwards from the "end" of a file, or relatively to the "current" file position), thus it has to be a variable:
    Code:
    RFile file...
    TInt pos=22;
    file.Seek(ESeekStart,pos);
    also note that there is RFileReadStream, which may be better for your purpose:
    Code:
    RFile file...
    RFileReadStream frs(file,22);
    TInt16 i=frs.ReadInt16L();
    TInt32 j=frs.ReadInt32L();

  3. #3
    Registered User
    Join Date
    Sep 2008
    Posts
    40

    Re: How to use RFile instance to seek some bytes?

    Quote Originally Posted by wizard_hu_ View Post
    RFile is not that complex, and actually it has a Seek method. The only difficulty that the position is a bi-directional argument (it will contain the resulting position which makes sense if you are seeking backwards from the "end" of a file, or relatively to the "current" file position), thus it has to be a variable:
    Code:
    RFile file...
    TInt pos=22;
    file.Seek(ESeekStart,pos);
    also note that there is RFileReadStream, which may be better for your purpose:
    Code:
    RFile file...
    RFileReadStream frs(file,22);
    TInt16 i=frs.ReadInt16L();
    TInt32 j=frs.ReadInt32L();
    Thank you so much, let me try and tell you. :)

Similar Threads

  1. question about Seek() func in RFile
    By ptclin_2007 in forum Symbian
    Replies: 1
    Last Post: 2008-04-14, 04:28
  2. Nokia 30 SMS sending problem !!!!!
    By pgredelj in forum General Messaging
    Replies: 1
    Last Post: 2004-01-12, 12:48

Posting Permissions

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