Re: MyMutableString Class
- From: vaib <vaibhavpanghal@xxxxxxxxx>
- Date: Thu, 17 Sep 2009 04:47:30 -0700 (PDT)
On Sep 16, 4:22 pm, "Alberto Poblacion" <earthling-
quitaestoparacontes...@xxxxxxxxxxxxx> wrote:
"vaib" <vaibhavpang...@xxxxxxxxx> wrote in message
news:47896db3-6c96-4f56-93a9-b367ef5f96d9@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
What should I do if I have to make a class , say, MyMutableString ,
that takes in a String object ( any string literal ) and does
modifications ( like append, etc ) on the same memory location where
that String object is stored without making use of pointers (, ie, not
making use of any unsafe code ). So the question boils down to - How
can I possibly access the memory location where the String object is
stored without the use of unsafe code ?? If I am able to do it then
making the "MyMutableString" class won't be a hassle.
I have searched a lot for this problem and no solution seems to be in
sight. So i turn to usenet ( as always ) for help.
Inside your class, you could allocate a char array with enough space for
the largest string that you wish to manipulate. Then store the characters of
the string in the char array. You can manipulate the string without
allocating or deallocating memory by just moving around the chars in the
array (and keeping a local variable to serve as an index to the last
position in use).
but character array would not be at the same memory location. I need
to access the memory location of the string..!
.
- Follow-Ups:
- Re: MyMutableString Class
- From: J.B. Moreno
- Re: MyMutableString Class
- From: rossum
- Re: MyMutableString Class
- From: Alberto Poblacion
- Re: MyMutableString Class
- References:
- MyMutableString Class
- From: vaib
- Re: MyMutableString Class
- From: Alberto Poblacion
- MyMutableString Class
- Prev by Date: Re: Constructor
- Next by Date: InsertOnSubmit for linq inserts data at first row in table.
- Previous by thread: Re: MyMutableString Class
- Next by thread: Re: MyMutableString Class
- Index(es):
Relevant Pages
|