Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



How to parse a pathname


A simple parse

You can useTParse::Set() to perform a simple which retrieves components of the path name. RFs::Parse() uses default and related paths.

_LIT(KSpec,"A:file1");
_LIT(KRelated,"C:\\path1\\related.xxx");
TParse fp;
fp.Set(KSpec,&KRelated,NULL);

The following table following table shows filenames and their component parts and the result of the parse:

drive

path

filename

extension

file specification

A:

file1

related name

C:

\path1\

related

.xxx

default name

result

A:

\path1\

file1

.xxx

The resultingfp.fullname will be A:\path1\file1.xxx. All the components that are specified in the file specification (drive and filename) are put into the result; any missing components (path and extension) are taken from the related file specification which has next order of precedence; nothing is specified in the default.

[Top]


Wildcards

You can use wildcards in the filename and extension.

TParse fp; _LIT(KSpec,"A:file1");
_LIT(KDefault,"C:\\path1\\*.*"); fp.Set(KSpec,NULL,&KDefault);

The following table following table shows filenames and their component parts and the result of the parse:

drive

path

filename

extension

file specification

A:

file1

related filename

default filename

C:

\path1\

*

.*

result

A:

\path1\

file1

.*

The resultingfp.fullname will be A:\path1\file1.*