Click to See Complete Forum and Search --> : filenames


May 12th, 1999, 02:36 AM
assuming that i have a program that allows me to save files. how do i make the default filenames to be ( let say ) "image0" for the first file, "image1" for the second file and so on ?

Le Sant Yves
May 12th, 1999, 03:39 AM
dear anonymous,

try this simple things:
Assuming that your class is CMyImage, add 2 statics members:
static CString m_sBaseName;
static int m_nNumber;

Provide also a method that asks for m_sBaseName and inits m_nNumber to 0

Then each call to a method as SaveImage will create the name of the saved file as:
CString name;
name.Format("%s%d",CMyImage::m_sBaseName,CMyImage::m_nNumber);
CMyImage::m_nNumber++;

That's all and is simple (because I am used to do that!).

Hope this will help you





Yves Le Sant
Metrology and Measurement Unit
Fundamental and Experimental Aerodynamics Departement
ONERA Meudon
(Office National d'Etudes et de Recherches Aérospatiales)
FRANCE

april
May 13th, 1999, 12:47 PM
hi...

thanx for your reply. i'll try that tomorrow. i'm new to VC++ programming and kind of have a deadline to meet for my project. your help is very much appreciated.