Symbian
Symbian OS Library

FAQ-0456 I don't want to get a data file when I run my application.

[Index][spacer] [Previous] [Next]



 

Classification: C++ Category: Application architecture
Created: 12/21/99 Modified: 05/25/2001
Number: FAQ-0456
Platform: ER5

Question:
Whenever I run my application a file is created in C:\Documents\ with the same name as my application. How can I avoid this?

Answer:
There are two ways to do this. The first is by replacing a function, while the second only works if you are using a resource file.
1. You need to replace the function CEikApplication::GetDefaultDocumentFileName()with one that returns an empty file name, like this function does:

void CMyApplication::GetDefaultDocumentFileName(TFileName& aDocumentName) const
{
aDocumentName.Zero();
}

where CMyApplication is a subclass of CEikApplication.

Although the above will work whether or not you have a resource file, it is easier to use the following if you do have a resource file.

2. It is usual to have the following near the top of a resource file:

RESOURCE TBUF { buf=""; }

If the string specified here has zero length (as it does here) then you will not get a file created.