File Server: File Processing

Source: Internet
Author: User

 

* File Server
-Access through the client API, which is defined in f32file. h
(Drive A--Z: C is the system's internal storage location, z is the ROM read-only memory reserved, other can be arbitrarily allocated)
* File Server session
-All files are accessed through sessions.
-ApplicationProgramThere may be multiple sessions
-Enable a session using the RFS class

 

* Connect to the file server
-Increase the number of resources
-The resource must be closed after the operation is completed, for example
RFS fssession;
User: leaveiferror (fssession. Connect ());
......
Fssession. Close ();

* Instances provided by the cone environment, such:
RFS & FS = ccoeenv: static ()-> fssession ();

 

 

* RFS functions include:
-Add, delete, move, and rename files and directories
-Retrieve the Directory List
-Keep the default path containing the drive letter and Path
-Get Drive and volume information
-Notification events requesting important changes

* In the following file access example, the cdir class contains a directory list
RFS & FS = ccoeenv: static ()-> fssession ();
Cdir * anentrylist = NULL;
_ Resolve (kpath, "C: // Nokia //");

User: leaveiferror (FS. getdir (kpath, kentryattnormal, esortbyname, anentrylist ));
// Iteratively access this list
For (tint I = 0; I <anentrylist-> count (); I ++)
{
Const tentry & anentry = (* anentrylist) [I];
Tbuf <kmaxfilename> name = anentry. INAME;
Tuint iattributes = anentry. IATT;
Tint isize = anentry. isize;
}

Delete anentrylist;
Anentrylist = NULL;

 

 

 

Read/write files
* Rfile class
-Provide a handle to open a single file
-Rfile: Create () open a new file for writing
-Rfile: open () open an existing file for access
-Rfile: Replace () deletes an existing file and opens a new file, or directly creates a new file if the file does not exist.
-Rfile: flush () writes cached data to a file.
-Rfile: Close () to close the file
* File read/write Method
-Rfile: Read () and rfile: Write ()
-Only applicable to 8-bit binary data or ASCII text
-It cannot be used for other data types.
-Stream is more suitable for file read/write operations.

 

 

Use rfile to operate binary data
* Access Binary data
* The rfile class indicates a file.
* Once the file is opened, data can be read/written.
-Rfile: Read ()
-Rfile: Write ()
* File data is processed as binary data or ASCII text
* Use the byte Descriptor
-Tdes8, tdesc8, and so on
* Series60 only supports Unicode, so this function has limited applicability.

 

 

* Deleting files and directories
-The file cannot be open or read-only.
-You cannot delete system files.
-The Directory must be empty.
-The root directory cannot be deleted.
-Use RFS: delete () for files and RFS: rmdir () for directories ()
 

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.