Click here to Skip to main content
15,916,215 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionDelete or lock a running executable file Pin
paaexis6-Nov-07 1:21
paaexis6-Nov-07 1:21 
AnswerRe: Delete or lock a running executable file Pin
led mike6-Nov-07 4:09
led mike6-Nov-07 4:09 
AnswerRe: Delete or lock a running executable file Pin
paaexis6-Nov-07 22:25
paaexis6-Nov-07 22:25 
QuestionDesign Fancy Buttons (Windows Forms Application (.Net)) Pin
Kunal Bajpai6-Nov-07 1:11
Kunal Bajpai6-Nov-07 1:11 
QuestionString Conversion Pin
Paulraj G6-Nov-07 0:54
Paulraj G6-Nov-07 0:54 
AnswerRe: String Conversion Pin
manish.patel6-Nov-07 1:05
manish.patel6-Nov-07 1:05 
GeneralRe: String Conversion Pin
Paulraj G6-Nov-07 1:09
Paulraj G6-Nov-07 1:09 
GeneralRe: String Conversion Pin
toxcct6-Nov-07 1:53
toxcct6-Nov-07 1:53 
Manish_mnp wrote:
tch = str.GetBuffer();


NO !!!!!

GetBuffer() is not designed to cast a CString to a C-Style String but to access its internal buffer directly. very badly used then.
Moreover, when you use it, you have to call ReleaseBuffer() then, which you don't do here.
if you only need to cast the Cstring, use the cast operators it provides : (LPCTSTR) for instance...

there are other design issues in your code:

Manish_mnp wrote:
CString str;
str = "Manish";


you should prefer declare with using the _T() macro, because if the UNICODE macro is defined, you force the CString to be initialized with an ANSI string, not multi byte.


Manish_mnp wrote:
new TCHAR[10];


never new something without releasing its memory with delete !! you're leading to memory lacks, which is simply not acceptable.

Manish_mnp wrote:
char ch = "Manish";
CString str(ch);


here too, you have a problem because you're assuming the state of the UNICODE macro.
you'd better have to write :
TCHAR ch = _T("Manish");
CString str(ch);



GeneralRe: String Conversion Pin
manish.patel6-Nov-07 23:28
manish.patel6-Nov-07 23:28 
GeneralRe: String Conversion Pin
toxcct6-Nov-07 23:56
toxcct6-Nov-07 23:56 
GeneralRe: String Conversion Pin
manish.patel7-Nov-07 0:16
manish.patel7-Nov-07 0:16 
GeneralRe: String Conversion Pin
Nelek7-Nov-07 0:25
protectorNelek7-Nov-07 0:25 
GeneralA remark Pin
CPallini6-Nov-07 1:54
mveCPallini6-Nov-07 1:54 
GeneralRe: String Conversion Pin
Cedric Moonen6-Nov-07 1:57
Cedric Moonen6-Nov-07 1:57 
GeneralRe: String Conversion Pin
David Crow6-Nov-07 3:06
David Crow6-Nov-07 3:06 
AnswerRe: String Conversion [modified] Pin
toxcct6-Nov-07 1:46
toxcct6-Nov-07 1:46 
GeneralRe: String Conversion Pin
David Crow6-Nov-07 3:11
David Crow6-Nov-07 3:11 
GeneralRe: String Conversion Pin
toxcct6-Nov-07 3:13
toxcct6-Nov-07 3:13 
QuestionListView Pin
nitin36-Nov-07 0:03
nitin36-Nov-07 0:03 
AnswerRe: ListView Pin
CPallini6-Nov-07 0:11
mveCPallini6-Nov-07 0:11 
AnswerRe: ListView Pin
Nelek6-Nov-07 1:57
protectorNelek6-Nov-07 1:57 
AnswerRe: ListView Pin
Sam Hobbs6-Nov-07 16:06
Sam Hobbs6-Nov-07 16:06 
QuestionContext Menu problem Pin
neha.agarwal275-Nov-07 23:49
neha.agarwal275-Nov-07 23:49 
Questioncan anybody tell me how to print the datagrid.I am using ado to load the datagrid Pin
SnaKeBeD5-Nov-07 23:49
SnaKeBeD5-Nov-07 23:49 
AnswerRe: can anybody tell me how to print the datagrid.I am using ado to load the datagrid Pin
chandu0046-Nov-07 1:40
chandu0046-Nov-07 1:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.