×

Discussion Board

Results 1 to 13 of 13

Thread: append to file

Hybrid View

  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    135

    append to file

    i have a list box. when i am pressing ok button on listbox the data is written in the file. but the problem is when another item is selected, the previous item is replace in the file.

    is there any method to append data in file.

    i am using RFs, RFile, RFileWriteStream
    and to write data i use
    RFileWriteStream writer;
    writer<<buf;

  2. #2
    Regular Contributor
    Join Date
    Oct 2004
    Location
    india
    Posts
    306

    Re: append to file

    u can append to file this way:

    use replace funtion to open a file also,
    to write data into file,write(x,data); where x intially 0,then assign length of data+1 to x,
    so next time when u write data into file it starts from data+1 and again.

  3. #3
    Registered User
    Join Date
    Aug 2005
    Posts
    135

    Re: append to file

    ya i know that but my problem is that i have data in


    TBuf<256> nameBuf
    and write accepts data in TDesC8

    how can i change the namebuf from TBuf<> to TDesC8

  4. #4
    Regular Contributor
    Join Date
    Oct 2004
    Location
    india
    Posts
    306

    Re: append to file

    jusz copy TBuf<256> data into TBuf8<256> then "trimall"

  5. #5
    Registered User
    Join Date
    Aug 2005
    Posts
    135

    Re: append to file

    TBuf8<256> name;
    name.Copy(nameBuf);
    TDesC8& name1=name;
    file.Write(0,name1);

    is this the ok method. i am actually writing the contact ID (TInt ) of contact database.
    when i was using writer<<nameBuf, the text file created showed the id properly ie. 13 or 14

    but now is is showing unreadable character. is it ok

  6. #6
    Regular Contributor
    Join Date
    Oct 2004
    Location
    india
    Posts
    306

    Re: append to file

    TBuf8<256> name;
    name.Copy(nameBuf);

    y do u need this line ...i dont understand
    /////////TDesC8& name1=name;

    instead u can directly pass name into this
    file.Write(0,name);

  7. #7
    Registered User
    Join Date
    Aug 2005
    Posts
    135

    Re: append to file

    thanks u verymuch
    it was just now working fine but there is still one problem
    after continuously adding two or three records it starts replacing the old ones.
    is there any way to get the length of the file so that records are added each time at the end of the file.


    thanks very much

Similar Threads

  1. Tips on using NDS 1.1
    By mitts in forum Symbian Tools & SDKs
    Replies: 7
    Last Post: 2006-01-18, 16:07
  2. Replies: 1
    Last Post: 2005-05-26, 14:22
  3. Series 60 SDK Appwizard on windows xp
    By moonjoor in forum Symbian Tools & SDKs
    Replies: 15
    Last Post: 2003-12-24, 10:22
  4. nokia 7210 modem via IR doesn't work !
    By oussamaaiadi in forum PC Suite API and PC Connectivity SDK
    Replies: 1
    Last Post: 2003-03-06, 10:46
  5. Replies: 0
    Last Post: 2002-06-10, 12:24

Posting Permissions

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