|
I test my DLL in machine write DLL , so that MFC and also visual C are install.
|
|
|
|
|
Right. But, CAsyncSocket is an MFC class, so MFC needs to be initialized on the DLL.
Also, you'll need an MFC message loop on a thread somewhere to handle the windows messages.
Why not just use the Sockets APIs? CAsyncSocket is just a thin wrapper around them anyway.
Mark
|
|
|
|
|
Thanks,
I didn't work with Socket APIs as yet , let me know if you have any samples or
guide me anyway .
|
|
|
|
|
hameduser wrote: I didn't work with Socket APIs as yet , let me know if you have any samples or
guide me anyway .
You'd need to understand sockets to use CAsyncSocket as well.
Here's the Microsoft documentation: Windows Sockets 2[^]
Here's links to many articles: CP Search Articles[^]
Mark
|
|
|
|
|
char folder[] = "C:\\My_Folder\\";
char *oldFile;
int old = 1;
sprintf(oldFile, "%sMyFile%02d.xml", folder, old);
if( remove(oldFile)
{
sprintf(text, " { Error } Failed to remove %s.", oldFile);
LOG(text);
}
Even "C:\My_Folder\MyFile01.xml" is valid path, remove() failes to delete this file.
What should I use?( file is not read-only )
Why failed to remove the file?
|
|
|
|
|
Aniket Salunkhe wrote: char *oldFile;
Try to change the line to this:
char oldFile[MAX_PATH];
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|
|
I think first u hav to chk for access rights
..... if access rights r fine
then
try this...
char oldFile[512]; instead of char *oldFile
Hope this will help u ...
|
|
|
|
|
Even when I use
remove("C:\\My_Folder\\My_Files.xml");
File is not get deleted.
Also I tried using 'DeleteFile()' function.
( not deleting the file everytime)
What is the reason & solution?
|
|
|
|
|
Did you use of this file on your program?
|
|
|
|
|
Sorry to all.
Once the file opened to read data from it was,t closed properly. Because of which problem was generated.
Now it's working fine after closing the file properly.
Thanks to all of you.
|
|
|
|
|
|
You can also use of MoveFile
|
|
|
|
|
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);
|
|
|
|