Symbian3/PDK/Source/GUID-6F938BDA-15CB-566E-88E0-6DF9278F8304.dita
author Dominic Pinkman <Dominic.Pinkman@Nokia.com>
Fri, 22 Jan 2010 18:26:19 +0000
changeset 1 25a17d01db0c
child 3 46218c8b8afa
permissions -rw-r--r--
Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
     1
<?xml version="1.0" encoding="utf-8"?>
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
     2
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
     3
<!-- This component and the accompanying materials are made available under the terms of the License 
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
     4
"Eclipse Public License v1.0" which accompanies this distribution, 
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
     5
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
     6
<!-- Initial Contributors:
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
     7
    Nokia Corporation - initial contribution.
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
     8
Contributors: 
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
     9
-->
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    10
<!DOCTYPE concept
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    11
  PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    12
<concept xml:lang="en" id="GUID-6F938BDA-15CB-566E-88E0-6DF9278F8304"><title>How to get and change file details</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>The <xref href="GUID-1F240E05-55D4-3161-B22E-B48D93A981DF.dita"><apiname>TEntry</apiname></xref> and <xref href="GUID-0355B083-6DD8-30F0-BEDF-B6BE745E2AB6.dita"><apiname>TEntryArray</apiname></xref> classes are used to store, retrieve, interrogate and sort directory entries. <codeph>TEntry</codeph> encapsulates a single directory entry and <codeph>TEntryArray</codeph> an array of directory entries. </p> <section><title>Retrieving entry details</title> <p>Use <xref href="GUID-E263C747-946F-35AA-9F1D-41833BD350FC.dita#GUID-E263C747-946F-35AA-9F1D-41833BD350FC/GUID-58F5BAD5-0D8C-33C9-B93B-D1C48F53333A"><apiname>RFs::Entry()</apiname></xref> to retrieve the size of the file, its attributes, name and the date and time of its latest modification (if the file has not been modified, this will be the time of its creation). </p> <codeblock id="GUID-3FE04CB5-8305-54DC-9904-1882AB6035E2" xml:space="preserve">  // Get and print date/time and file size 
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    13
TBuf&lt;30&gt; dateString; 
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    14
TEntry entry;
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    15
User::LeaveIfError(fsSession.Entry(path,entry)); 
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    16
_LIT(KDateString,"%D%M%Y%/0%1%/1%2%/2%3%/3 %-B%:0%J%:1%T%:2%S%:3%+B");
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    17
entry.iModified.FormatL(dateString,KDateString); 
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    18
_LIT(KModString, "Modification time of %S is %S\n"); // Format and print date and time
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    19
console-&gt;Printf(KModString, entry.iName,&amp;dateString); // Get file size
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    20
_LIT(KSizeString, "Size = %d bytes\n");
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    21
console-&gt;Printf(KSizeString,entry.iSize); </codeblock> <p><b>Notes</b> </p> <ul><li id="GUID-61C99E94-C6F9-582F-BF94-CCA57A53DC0E"><p>The time extracted using <codeph>TEntry::iModified</codeph> (and by <codeph>RFs::Modified()</codeph>) is an object of class <codeph>TTime</codeph>. Before a <codeph>TTime</codeph> value can be displayed, it must either be converted into its numeric fields (i.e., into a <codeph>TDateTime</codeph> object), or formatted, using <codeph>TTime::FormatL()</codeph>, as above. </p> </li> </ul> </section> <section><title>Changing attributes</title> <p>Use <xref href="GUID-E263C747-946F-35AA-9F1D-41833BD350FC.dita#GUID-E263C747-946F-35AA-9F1D-41833BD350FC/GUID-E1CB09AF-F5B0-35B2-B24E-C6F5F1C583C8"><apiname>RFs::SetAtt()</apiname></xref> to set a file or directory's attributes. It requires two attribute mask arguments. Any attributes specified in the first mask are set and any specified in the second are cleared. No attributes may be specified in both bitmasks. </p> <p>In the following example, the hidden and system attributes are set and the archive attribute is cleared. </p> <codeblock id="GUID-3C0120A7-7023-5967-A9C0-4ADB4483127B" xml:space="preserve">_LIT(KString,"%S");
25a17d01db0c Addition of the PDK content and example code for Documentation_content according to Feature bug 1607 and bug 1608
Dominic Pinkman <Dominic.Pinkman@Nokia.com>
parents:
diff changeset
    22
User::LeaveIfError(fsSession.SetAtt(path,KEntryAttHidden|KEntryAttSystem,KEntryAttArchive)); </codeblock> </section> </conbody></concept>