Click here to Skip to main content
16,011,870 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to delete specific elements in a char pointer Pin
jhwurmbach11-Oct-07 3:31
jhwurmbach11-Oct-07 3:31 
GeneralRe: how to delete specific elements in a char pointer Pin
Priya_Sundar11-Oct-07 1:42
Priya_Sundar11-Oct-07 1:42 
GeneralRe: how to delete specific elements in a char pointer Pin
toxcct11-Oct-07 1:48
toxcct11-Oct-07 1:48 
GeneralRe: how to delete specific elements in a char pointer Pin
jhwurmbach11-Oct-07 1:58
jhwurmbach11-Oct-07 1:58 
QuestionRe: how to delete specific elements in a char pointer Pin
David Crow11-Oct-07 3:45
David Crow11-Oct-07 3:45 
GeneralRe: how to delete specific elements in a char pointer [modified] Pin
chandu00411-Oct-07 4:01
chandu00411-Oct-07 4:01 
GeneralRe: how to delete specific elements in a char pointer Pin
chandu00411-Oct-07 4:05
chandu00411-Oct-07 4:05 
GeneralRe: how to delete specific elements in a char pointer Pin
Matthew Faithfull10-Oct-07 23:23
Matthew Faithfull10-Oct-07 23:23 
OK firstly we need to establish the meaning of 'delete' in this context. In C++ delete tends to means 'free the memory'. You certainly can't 'free the memory' currently being used by the '{' and the '}' so in C++ terms you can't 'delete' the first and last characters.
What you want is to end up with String pointing at "abcdef". You could do this with 2 lines

<br />
String++;<br />
String[6] = '\0';<br />


This will make the charatcer pointer point at the next character and then 'blank out' the end '}' (which is 6 characters on from the 'a' that String now points at) by replacing it with a NULL

There is one problem with this of course. You now have no way to free the string memory as the original value of String is lost. If your string is on the heap you will need to solve this. Enjoy.



Nothing is exactly what it seems but everything with seems can be unpicked.

AnswerRe: how to delete specific elements in a char pointer Pin
toxcct10-Oct-07 23:33
toxcct10-Oct-07 23:33 
GeneralRe: how to delete specific elements in a char pointer Pin
Priya_Sundar10-Oct-07 23:48
Priya_Sundar10-Oct-07 23:48 
GeneralRe: how to delete specific elements in a char pointer Pin
jhwurmbach11-Oct-07 0:48
jhwurmbach11-Oct-07 0:48 
AnswerRe: how to delete specific elements in a char pointer [modified] Pin
Nelek11-Oct-07 0:15
protectorNelek11-Oct-07 0:15 
QuestionHow to use InvokeHelper function in C++? Pin
PhanMinhDuy10-Oct-07 22:37
PhanMinhDuy10-Oct-07 22:37 
Question[SOLVED]type specifier for UINT64 Pin
chandu00410-Oct-07 22:36
chandu00410-Oct-07 22:36 
AnswerRe: type specifier for UINT64 Pin
Nelek10-Oct-07 22:51
protectorNelek10-Oct-07 22:51 
AnswerRe: type specifier for UINT64 Pin
Nibu babu thomas10-Oct-07 22:52
Nibu babu thomas10-Oct-07 22:52 
General[SOLVED] thanks Pin
chandu00410-Oct-07 22:59
chandu00410-Oct-07 22:59 
Questionhdc to Bitmap Pin
GauranG Shah10-Oct-07 22:11
GauranG Shah10-Oct-07 22:11 
AnswerRe: hdc to Bitmap Pin
Mark Salsbery11-Oct-07 12:50
Mark Salsbery11-Oct-07 12:50 
GeneralRe: hdc to Bitmap [modified] Pin
GauranG Shah11-Oct-07 18:59
GauranG Shah11-Oct-07 18:59 
GeneralRe: hdc to Bitmap Pin
Mark Salsbery11-Oct-07 20:56
Mark Salsbery11-Oct-07 20:56 
GeneralRe: hdc to Bitmap Pin
GauranG Shah11-Oct-07 22:58
GauranG Shah11-Oct-07 22:58 
GeneralRe: hdc to Bitmap Pin
Mark Salsbery12-Oct-07 4:57
Mark Salsbery12-Oct-07 4:57 
GeneralRe: hdc to Bitmap [SOLVED] Pin
GauranG Shah11-Oct-07 23:51
GauranG Shah11-Oct-07 23:51 
GeneralRe: hdc to Bitmap [SOLVED] Pin
Mark Salsbery12-Oct-07 4:58
Mark Salsbery12-Oct-07 4:58 

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.