creating filenames dynamically

Login to reply to this topic.
Fri, 2005-09-30 19:20
Joined: 2005-07-28
Forum posts: 63
I've been doing a screenshot program, and thus far have hardcoded my filename and path.

CFbsBitmap* iBitmap;
iBitmap = new (ELeave) CFbsBitmap();
TInt err = iBitmap->Create(TSize(352,416),EColor64K);
CEikonEnv::Static()->ScreenDevice()->CopyScreenToBitmap(iBitmap);
iBitmap->Save(_L("C:\\Nokia\\Images\\test.mbm"));

The problem with this is that if I want to create several screenshots, they will all overwrite the original "test.mbm".  I want to make it so it will start out at "test001.mbm", then the next screenshot will go to "test002.mbm" etc.  Is there any way to do this by parsing the filenames of the existing files in the directory?

Thanks,
the badge Afro

Fri, 2005-09-30 19:43
Forum Nokia Champion
Joined: 2003-06-10
Forum posts: 720
Re: creating filenames dynamically
Start by taking a look at the SDK documentation for various file and directory APIs. The section "File Server Client Side" in the C++ API Reference would be a good start (look, e.g., at TFindFile to find existing files in a directory matching a pattern).

Fri, 2005-09-30 20:30
Joined: 2005-07-28
Forum posts: 63
Re: creating filenames dynamically
Found a solution:  Google "symbian GenerateFileName"
Thu, 2005-11-17 07:40
Joined: 2005-11-16
Forum posts: 34
Re: creating filenames dynamically
Many possibilities:

1. Use the current date and time? like 2005-11-17-13-00-58.mbm
2. Use the current date time in milliseconds 0123456789.mbm
3. Make a counter to track the last file count and append it to your image name.
4. Use MD5
5. many, many more
  • Login to reply to this topic.