Dwood15 wrote:
I have a string that needs to be exposed and editable, it's a cstring (<typedef> const char* name, to be exact).
Why do you need something that is a constant and editable? Can you not change the typedef because it is part of a shared object? Also, I don't have my Ansi-C manual handy but iirc a const pointer isn't the same thing as a normal constant. You need to check.
What do you mean by "exposed"?
BTW, creating a typedef called cstring is a bit dangerous. Most people consider a cstring to be a char[] in C. The point of using a typedef is to make the type definition more refined. For example, if I'm representing playing cards using an int value and a hand as an array of five ints, I would want to create Card and Hand typedefs. Creating a cstring typedef doesn't really do a whole lot especially when it isn't what most people consider to be a cstring.
Dwood15 wrote:
I'm posting here because all of my attempts have failed, but here's the twist: it has to stay as said cstring. Should I make a pointer to a &name?
Can you provide a snippet of the code? I'm having trouble imaging where things are going wrong. Is it when you call a function expecting a cstring? That doesn't seem likely. How about returning one? Why use one? etc.