"Thomas Matthews" <Th*************************@sbcglobal.net> wrote in
message news:42************@sbcglobal.net...
Ia******@hotmail.com wrote: Hi
I was wondering if anyone knew how to convert a string or an integer
into a Static Char.
Try this:
static char c;
int main(void)
{
c = 'A'; // Converts 'A' into a static char.
c = '1'; // Converts a literal numeric into a char.
return 0;
}
If this doesn't satisfy you, please be more descriptive
as to what you are seeking.
--
Thomas Matthews
Well, considering he asked about converting a string or an integer, and
since 'A' is not a string and '1' is not an integer, I suspect it won't
satisfy.
Like you, however, I await clarification as to exactly what the heck he
*does* want! :-)
To the OP:
When you say you want to "convert ... to a static char", that doesn't really
make sense. Do you mean you want to know how to put the contents of a
string (i.e., std::string) into an array of char (a C-style string), and how
to convert an integer into an C-style string as well? Or...???
A char (watch your capitalization, it's important in C++) is a single
character, and is not going to be able to hold an integer (if it's outside
the range of 0..9) or a string (if the string is longer than 1 character).
With the keyword "static" in front of it, it means different things,
depending upon where it's used. A static member variable is different from
a non-member variable declared as static. (I hate that those different
concepts use the same keyword, but what're you gonna do, eh? :-))
Research the keyword "static". Also research "array of char", or C-style
strings. And if by "string" you meant the class std::string, look that up,
too.
-Howard