|
sorry my mistake not bufCharCount but infoBuf
pc.assign( infoBuf );
-----------
Mila
|
|
|
|
|
Sorry bro but:
Error 1 error C2664: 'std::basic_string<_Elem,_Traits,_Ax> &std::basic_string<_Elem,_Traits,_Ax>::assign(const std::basic_string<_Elem,_Traits,_Ax> &)' : cannot convert parameter 1 from 'TCHAR [32767]' to 'const std::basic_string<_Elem,_Traits,_Ax> &' c:\documents and settings\qx55246\my documents\visual studio 2005\projects\testsmsintferface\testsmsintferface\testsmsintferface.cpp 24
TCHAR infoBuf[INFO_BUFFER_SIZE];
DWORD bufCharCount = INFO_BUFFER_SIZE;
GetComputerName( infoBuf, &bufCharCount );
string pc;
pc.assign( infoBuf );
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
ok, you use VS2005 (I've just noticed it). There is UNICODE by default.
TCHAR is defined as a wchar_t and to cooperating with it is std::wsting.
If you really need convet it, you can use e.g. wcstombs or W2A
-----------
Mila
|
|
|
|
|
Thnx alot Mila for the help and quick replies ....
ANSWER:
wchar_t infoBuf[INFO_BUFFER_SIZE];
DWORD bufCharCount = INFO_BUFFER_SIZE;
GetComputerName( infoBuf, &bufCharCount );
wstring pc = infoBuf;
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
|
|
I would suggest some modifications to your code,
TCHAR infoBuf[INFO_BUFFER_SIZE];
DWORD bufCharCount = INFO_BUFFER_SIZE;
GetComputerName( infoBuf, &bufCharCount );
string a;
#ifdef UNICODE
size_t i;
char temp[INFO_BUFFER_SIZE];
wcstombs_s(&i,temp,(size_t)INFO_BUFFER_SIZE,infoBuf,(size_t)INFO_BUFFER_SIZE);
a.assign(temp);
#else
a.assing(infoBuf);
#endif
|
|
|
|
|
Thnx for the pointers Prasad ... I appriciate the help
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
One more way to achieve this. Save one function call,too.
TCHAR infoBuf[INFO_BUFFER_SIZE];
GetComputerName( infoBuf, &bufCharCount );
basic_string<TCHAR> pc(infoBuf);
|
|
|
|
|
Thnx Prasad,
But my fubction accepts a std::string and when I do this:
TCHAR infoBuf[INFO_BUFFER_SIZE];
GetComputerName( infoBuf, &bufCharCount );
basic_string <TCHAR> pc(infoBuf);
this would happen:
Error 1 error C2664: 'CIniFile::SetValue' : cannot convert parameter 2 from 'std::basic_string<_Elem,_Traits,_Ax>' to 'std::string' c:\documents and settings\qx55246\my documents\visual studio 2005\projects\testsmsintferface\testsmsintferface\testsmsintferface.cpp 32
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r
|
|
|
|
|
If your language/tool supports WideCharToMultiByte and MultiByteToWideChar functions, you may use them for ASCII<->UNICODE string conversion.
Hope this helps.
Anand
|
|
|
|
|
how .tlh file get generated ? iam using vc 6.
|
|
|
|
|
You need to import valid type library in your project.
#import "MyComObj.tlb"
|
|
|
|
|
Hi all,
I am trying to build a application but i got error as follows :
FileToFile fatal error C1192: #using failed on 'c:\compression\from ecl\filetofile\debug\AxInterop..dll'
also this application have successfully build on other machine.
how can i solve this problem please suggest me .
thanks
bankey.
|
|
|
|
|
Banks K wrote: AxInterop..dll'
Are the double dots in the file name intentional?
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
Hi all,
I have created an ActiveX dll in VB and imported in VC++. Everything went fine, untill i defined a new function in the DLL. Now how do i make that function appear in MFC class.
|
|
|
|
|
I am having a union with a class member, that class has a
copyconstructor compiler is giving me error about that.
Is anything can be done about it or some round about.
|
|
|
|
|
sujeet_kulk wrote: I am having a union with a class member
How about a different design?
led mike
|
|
|
|
|
You can't: logically it makes no sense. How would the union know which constructor to call?
Steve
|
|
|
|
|
A union cannot contain a member having a copy constructor.
Revise your design.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
what is the syntax for calling stored procedure
|
|
|
|
|
is in the documentation at msdn.microsoft.com
"Alot of the people on this forum are incredibly stupid, thinking that the internet is real" Score: 1.0 in the Soap Box
led mike
|
|
|
|
|
abrakadbra wrote: what is the syntax for calling stored procedure
From?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Dear All,
I want to use virtual memory more rather than main memory.
I need virual memory usage techniques those can be applied for application that has no user interfaces (Dialogs).
Kindly let me know.
Thanks.
|
|
|
|
|
Virtual memory usage it's not up to you. OS provides that to applications.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|