Symbian rfilewritestream and rfile read and write files in append Mode

Source: Internet
Author: User

 

A log writing project has been created over the past few days, and the append method is used to write log files.

After investigation, the SDK found that such a function is not encapsulated in Symbian.

Therefore, you can only get your own clothes and food

The specific implementation process is as follows:

 


Symbian rfilewritestream and rfile read and write files in append Mode

 

Rfile file; <br/> // create the file for writing <br/> tint err = file. open (ccoeenv: static ()-> fssession (), kfile, efilewrite ); <br/> // file does not exist-create it <br/> If (ERR = kerrnotfound) <br/> err = file. create (ccoeenv: static ()-> fssession (), kfile, efilewrite); <br/> rfilewritestream writer; <br/> tint ifilesize = 0; <br/> file. size (ifilesize); <br/> writer. attach (file, ifilesize); <br/> writer. writel (createbuf); // write the content of timebuf to the stream <br/> writer. commitl (); // submit, equivalent to flush <br/> writer. close ();

It is mainly to first obtain the file size through the rfile: size function, and then locate it at the end of the file through the rfilewritestream: attach function.

This allows you to read and write files by append.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.