>> const char* charSequence = rawInput.c_str();
>>
>> - tony
>
> I will try this advice. How different C/C++ is from other
> languages. Implementation details are something to learn about and
> deal with. Keeps the mind sharp.
>
> Thanks a million!
>


I believe that that might not work as you expect. you don't own the
position of the return pointer from c_str(), so you can't guarantee
when it will still be around. (Well C++ gurus possibly could, but I
don't know.)

Therefore I would make your own variable pointer. And new[] it with
the length of the rawInput + 1. Then use strcpy() to copy over the
char array from one to the other.

IE:
    char * charSequence = new char[rawInput.length()+1];
    strcpy(charSequence, rawInput.c_str());

Then of course you need to use delete[] when you are done with it.

But I haven't had a chance to check it in Visual C++ yet. Hopefully
I'll get a look at it in a little bit after kids are asleep. If not
tonight it won't be until tomorrow evening that I'll get a chance.

Erik
_______________________________________________
PLUG mailing list
PLUG@lists.pdxlinux.org
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to