"Illia Baidakov" <il***@newchem.ru> wrote in
news:co**********@e22.peterstar.ru...
Hello, All!
Mercy me for a stupid question. I'm just newby.
Which type or class should I use for a comfortable strings manipulation,
namely for setting a first parameter for the fopen() function?
My first try was a using of the CHString class. But the compiler
complains that it can not convert CHString to LPSTR.
I do not wish to use fixed size TCHAR chVar[SIZE] arrays. Is it possible
to workaround its explicit using?
If yes, how?
I guess you are using C++?
This is not a .NET-Problem, actually .NET tries to solve the problem: the
other .NET-languages only have one string type (the .NET-string type). C++
has to support all the other ones for backward compatibility. (That should
explain why you didn't get many answers in a dotnet.general ng).
AFAIK fopen expects a const char*, or (unicode) fwopen const wchar_t*. Every
string class I know has a conversion to one of these types. Unfortunately I
don't know CHString. I know MFC's CString (which can implicitly be converted
to a const TCHAR*), and STL's std::string class (which has a const
c_str()-member function that supports this conversion). Maybe you should
look at this CHString's header file to find out the proper conversion.
Niki