|
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);
|
|
|
|
|
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
|
|
|
|