×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Aug 2003
    Location
    Italy
    Posts
    54

    Open various file's...

    I have an application that should read various file.
    When the user click on the "Next" button the display should show the contain of the next file....

    So, I don't know how to auto-increment the name of the file..
    In fact the file are called:
    01.txt
    02.txt
    03.txt
    etc...

    This is the code:

    in the header file:

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

    private:
    RFile File;
    RFs fsSession;
    TBuf8 <16> Riga;

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

    in the CPP file:

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

    void MyApplication::Open()
    {
    _LIT(Archivio, "c:\\lavori\\01.txt");
    fsSession.Connect();
    File.Open(fsSession,Archivio,EFileShareExclusive|EFileRead);
    File.Read(Riga);
    File.Close();
    fsSession.Close();
    }

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

    This code works fine, it open ONLY the file 01.txt and read the text...

    But I want something that when I call Open Function the first time it open the 01.txt, the second time it open the 02.txt, etc..
    Something that autoincrement the name of the file...

    Is it possible ?? If yes how ??? Let me know !!!

    Stefano - pergine@freemail.it

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Location
    Philippines
    Posts
    208
    hi,

    from top of my head:

    TBuf<32> buf;
    for(TInt i = 0; i < 10; i++)
    {
    buf.Format(_L("0%d.txt"), i);
    read.Open(rfs, buf, EFileRead);
    .....
    }


Posting Permissions

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