TParse, TParsePtr and TParsePtrC

This topic describes the parsing capabilities of the above said functions.

The above three classes are provided for parsing filenames. All provide the same parsing capability (except that the path passed to TParsePtrC cannot be modified, for example by adding or removing a directory), but they differ in several respects. TParse uses a 256 byte TFileName as an internal buffer to store a copy of the fully parsed filename. The other two classes on the other hand do not have any storage space. They should be used in preference to TParse when minimizing stack usage is a priority.

When using TParsePtr and TParsePtrC in preference to TParse, remember that:

  • unlike TParse, these classes do not provide an option to disallow the use of wildcards in the filename and extension

  • because the path to be parsed is efficiently passed as an argument to the constructor for a TParsePtr or TParsePtrC, if this path is invalid, construction will fail and a panic will occur. TParse, on the other hand, returns an error if the specified path is invalid

  • only instances of class TParse can be passed to calls to RFs::Parse()

  • TParsePtrC cannot modify the path which is passed to it, for example by adding or removing a directory

Filepath limitations

If the length of the file path is more than 256 characters, file operations such as rename, copy and delete results in an error. However, it is possible to create a filepath which exceeds 256 character limit as follows:

Consider the following path:

C:\Multimedia\AVCodec\testproduct\...\avtests.txt

Rename the AVCodec directory to AVCodec123456789123456789. If the length of the complete file path, C:\Multimedia\AVCodec123456789123456789\testproduct\...\avtests.txt exceeds 256 characters, any file operation will fail. Similarly, when you create a file with the filepath more than 256 characters will result in an error.

However, on the emulator, the limit may be less than 256 characters. See Files and locations section in the Emulator guide.