|
Hi,
I wann to connect to SFTP server using MFC .
How can I do that
Thank you
Sandeep
|
|
|
|
|
Hi all
I have the mother of all doubts - Whats the difference between normal C++ and managed one ?
Preciously I would like to know if I work with VC++ 6.0 is it managed c++ or unmanaged one ?
What about .NET VC++ ?
Can anyone tell me pls ?
redindian
|
|
|
|
|
|
Code genrated by VC++ 6.0 is unmanaged code and code generated by VC++.Net is managed code.
Regards
Atool
M.Atool
|
|
|
|
|
Not true
Code managed by VC.NET CAN be managed code, if you ask it to be. By default, it is not.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
|
Hi all,
I am troubling to convert from CString to char* in both unicode and debug mode.
//Snippet of code.
--------------------------------------------------------------------------
CString str = "this is a test";
char* pchar = new char[str.GetLength() + 1];
now how to store the string "this is a test" in pchar character pointer.
//-------------------------------------------------------------------------
Uday kiran
|
|
|
|
|
|
And then use of ReleaseBuffer()
|
|
|
|
|
GetBuffer a pointer to the internal CString buffer. it is not a good idea to get this modifiable buffer only if a conversion to char* is needed.
there are cast operators for that : (LPCTSTR) for instance.
|
|
|
|
|
AHHHH *scream* Stop using GetBuffer!!!
CString is such a nice encapsulation of char data. GetBuffer is rarely needed. There's
plenty of methods and operators to manipulate the string.
Mark
|
|
|
|
|
Hi ,
Try this :
CString str = "this is a test";
char* pchar = new char[str.GetLength() + 1];
memcpy(pchar , (LPCTSTR)str , str.GetLength() + 1);
Eli
|
|
|
|
|
eli15021979 wrote:
CString str = "this is a test";
char* pchar = new char[str.GetLength() + 1];
memcpy(pchar , (LPCTSTR)str , str.GetLength() + 1);
don't mix ansi, unicode and "T" strings...
i suggest this instead :
CString str = _T("this is a test");
TCHAR* pchar = new <code>TCHAR</code>[str.GetLength() + 1];
memcpy(pchar , (LPCTSTR)str , str.GetLength() + 1);
|
|
|
|
|
CString str = "this is a test";
char* pchar = new char[str.GetLength() + 1];
//then ....
strcpy(pchar, str.GetBuffer());
str.ReleaseBuffer();
It will copy the content from string to char *
|
|
|
|
|
nooo, don't use GetBuffer() when only a Cast operator does the job. read my previous answer[^].
use GetBuffer() if you need to modify the CString buffer internally
|
|
|
|
|
strcpy(pchar, (LPCTSTR)str);
strcpy(pchar, (const char*)str);
strcpy_s(pchar, str.GetLength()+1, (LPCTSTR)str);
strcpy_s(pchar, str.GetLength()+1, (const char*)str);
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
If you want to use GetBuffer then you need to call ReleaseBuffer
|
|
|
|
|
WhiteSky wrote: If you want to use GetBuffer then you need to call ReleaseBuffer
Only if you change the contents, right?
|
|
|
|
|
a CString in unicode builds is a wchar_t array, not a char.
If you want to store chars in a CString in a unicode build then use the specific CStringA type.
If you want to use the generic CString, you'll need to convert the unicode CString to a char
type (using the WideCharToMultiByte() or similar).
Mark
|
|
|
|
|
Now, I code a program that manage PCs by using TCP with CSocket class.
However when I check on console by shell command,
"netstat -na"
I can see the server and client is connected like as,
163.152.216.228:9000 163.152.216.70:1234 ESTABLISHED
163.152.216.70:1234 163.152.216.228:9000 ESTABLISHED
But, when I send a message on the server or the client,
the two do not get a message. Also, don't occure the OnReceive() events.
So, I tried it on debugging mode and checked that
the "Send" Function had the correct values and run exactly.
What is the problem ?
How can I solve it ?
Please, help me~
Always beside you,
Focused on Focus KWON
|
|
|
|
|
Hi
You mean to say you have written your server and client from derived class of CSOcket rgt ?
If so can you give me more details ?
Is your server dialog based or console application ?
If its a dialog based one then OnReceive() will run - no problem
If its a console aplication then OnReceive() will not receive from client because you need to TranslateMessage() and PeekMessage() which you can do by using a hidden CFrameWnd class .This is a known problem because in a console app the message handlers are not active by default .
So usually , most servers are written with Win32 socket APIs . Its not advisable to use CSocket for a server - but client is ok
redindian
|
|
|
|
|
Focus KWON wrote: How can I solve it ?
This library makes sending recieving a breaze. Network Development Kit 2.0[^]
I'd love to help, but unfortunatley I have prior commitments monitoring the length of my grass. :Andrew Bleakley:
|
|
|
|
|
Hi
All
I want to use LoadStringResource() function in DLL. When i used this function in DLL code there is error as undeclare indentifier. Is there need to include any .H file to use it.plz send me info abt how to use LoadStringResource function.
Thnaks
Atool
M.Atul
|
|
|
|
|
The API is called LoadString()
|
|
|
|
|
Can any one guide me how do I monitor / check the health of a hard disk ?
I have gone through the msdn but I could not find in MSDN. My program is targettd to run on windows XP pro/2000 pro.
I found VDS interfaces for this functionality but they are only supported by Windows Vista.
can you please help me on this?
haribabu
|
|
|
|