Can anybody please tell me how to do this correctly?
static int lCount;
lCount=lCount+1;
char sPath;
sPath="C:\\images\";
sPath = sPath + lCount;
sPath = sPath + ".jpg";
I am not knowingly using the framework (yet), just trying to get over
the first obstacles in my way.
Dimi
Dimi:
Well, it depends what language you want to use
C
C++
C++/CLI
This newsgroup is intended for C++/CLI. If you want an answer for C or C++, a
better group is
microsoft.public.vc.language
or the MSDN forum at
http://social.msdn.microsoft.com/forums/en-US/vclanguage/threads/
In any case, I think you would benefit by reading a good introductory book on
your language of choice.
--
David Wilkinson
Visual C++ MVP
> I didn't find that newsgroup :-(
http://groups.google.com/group/microsoft.public.vc.language/topics
HTH,
Giovanni
I like CString class from ATL; you can use it both from pure Win32/C++ and
also in C++/CLI.
CString offers a method named Format, that you can use to format strings
like this:
CString strPath;
strPath.Format( TEXT("C:\\images\\%d.jpg"), lCount );
If you want to use .NET Framework's System::String class, you could find the
String::Format method useful:
String ^ s = String::Format("C:\\images\\{0}.jpg", lCount);
HTH,
Giovanni
Dimi
It seems that CString is only available with MFC which I didn't want to
include...
Isn't there any other way to combine the string with the number?
Dimi
> Somehow I cannot get it to compile, it's tell me that CString is an
> undeclared identifier.
> I tried
> #include "string.h"
> #include <string>
>
> It seems that CString is only available with MFC which I didn't want to
> include...
CString was an MFC class with Visual C++ 6, but with VS.NET 2003 (a.k.a.
VC7.1) CString was factored out of MFC and was made available also for
non-MFC projects. In fact, CString is now an ATL class.
If you read CString documentation on MSDN:
http://msdn.microsoft.com/en-us/library/5bzxfsea.aspx
you can find that the header file required for using CString in non-MFC
projects is <atlstr.h>, as Jason Newell already pointed out.
The <string> standard header file is for STL's std::[w]string class (not for
CString)
http://msdn.microsoft.com/en-us/library/syxtdd4f.aspx
If your project is built using precompiled headers, you may want to add
#include <atlstr.h> in your "StdAfx.h" header file.
Giovanni
Dimi