As Caitlin mentioned, if you have a `Local<String> str` you can do
something like `char* myCharStr = *str;` to get the pointer to the
char array.  I believe however, you need to copy the string make a
change to it.  Something like

   Local<String> str( args[ 0 ] );  // original string from an argument
   char myCharStr[ str->Length() + 1 ];   // a right sized buffer on the stack
   strncpy( myCharStr, *str, str->Length() ); // copy the string
   myCharStr[ 0 ] += 128; // change the byte
   args->GetReturnValue()->Set( String::NewFromUtf8( isolate,
myCharStr, String::kNormalString, str->Length() ) ); // return it back
to user via the function return value


On Fri, Sep 25, 2015 at 10:05 AM, Caitlin Potter <[email protected]> wrote:
> Handle/Local implement an overloaded operator->, which allows access to
> methods of the class (template argument odd the handle), as if you were
> accessing methods through a pointer.
>
> On Sep 25, 2015, at 6:41 PM, Deepak Subramanian <[email protected]>
> wrote:
>
> Hi. Perhaps I am being very unclear hear.
>
> I want to read the first byte of a Handle<String> and change it if needed
> and pass to another function that requires a Handle<String> as input. How to
> ?
>
> On Friday, September 25, 2015 at 5:38:47 PM UTC+2, Ben Noordhuis wrote:
>>
>> On Fri, Sep 25, 2015 at 4:56 PM, Deepak Subramanian
>> <[email protected]> wrote:
>> > I don't understand.. I cannot get String* from a handle and process it ?
>> >
>> > After that if I needed to call some v8 code that needs handle<object> as
>> > an
>> > input, can I not create a string with the handle to satisfy it ?
>> >
>> > What exactly is unsafe about it ? [I am a noob]]
>>
>> The garbage collector can relocate the raw string while your
>> application is running.
>
> --
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
> --
> --
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.

-- 
-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to