* 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 ()