CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: filenames

  1. #1
    Guest

    filenames

    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 ?


  2. #2
    Join Date
    May 1999
    Posts
    37

    Re: filenames

    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

  3. #3
    Join Date
    May 1999
    Posts
    73

    Re: filenames

    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.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured