*char to int conversion I'm about to kill a child.

Hey there!,

I am trying to have a changing value in a member variable that is set to private.. Here is exactly what I mean.
 
SDL_Surface *TTF_RenderText_Shaded(TTF_Font *font, const char *text, SDL_Color fg, SDL_Color bg)

And here is my Code:
 
SDL_Surface *text_surface = TTF_RenderText_Shaded(testFont, *Temp, fontColor, bgColor);

My problem here is to have a changing value on my *Temp. I have a value system which needs the text to update whenever it gets changed.. So of course I got to use pointers to get pass the constant.. But for the love of god.. I am not able to.
So in conclusion I need someone to help me change a constant *char's value to an integer. I need the conversion as well because I am unable to do that too. I don't know what is wrong with me today but I am literally about to explode on this topic.

Thank you for any of your help and it is very very very very MUCH appreciated!

Sincerely,
Brady Nadeau
Last edited on
(This is copy pasted) For the char* to int conversion:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
int get_number(char* message_buffer)
{
     char* num_ptr = message_buffer + strlen(message_buffer) - 1;

     while(isdigit(num_ptr) && num_ptr > message_buffer)
          --num_ptr;

     int number = atoi(num_ptr);

     if(number > UINT16_RANGE)
          //Handle error here

     return number;     
}

Yeah. Thats awesome.. But I wanted the exact opposite. XD
Ahh ur wording is backwards :p

This one I can do !

1
2
3
4
char myChar[10];
int myInt=1234;

myChar=itoa(myInt, myChar, 10);


And myInt = atoi(myChar); would do the opposite. Though, there are better functions out there than atoi...
Last edited on
Sorry again soranz but.. I need mychar to actually be *mychar...
and that is giving me this error:
mychar needs to be a modifiable lvalue
I am trying to have a changing value in a member variable that is set to private..
What member variable? Why private? is the latter important?

Here is exactly what I mean.
You know that it's neither a variable nor private? exactly = diffusely?

And here is my Code:
It's a one liner. What information does it bear?

My problem here is to have a changing value on my *Temp.
Do you want to change Temp or um not? Is this the mysterious member variable you were talking about?

I have a value system which needs the text to update whenever it gets changed..
The text needs to be updated when it changes? What is this mysterious value system? That gets somehow active? Or does the value system change?

So of course I got to use pointers to get pass the constant..
What constant?
Okay pointers and constant are/is involved? It looks like they're somehow connected? But how? What has this to do with the afore mentioned?

So in conclusion I need someone to help me change a constant *char's value to an integer.
Wow, what a surprise. That's the conclusion of that above? I'd never come to this in a million years.

At least it looked like the first understandable sentence. But then
But I wanted the exact opposite.


You know I love riddles, but this seems far beyond my horizon. Is this solvable?
Oh sorry, I guess I didn't finish. It goes like this:

char myChar[10];
char *pChar = myChar;
char *yChar = &myChar[0];

U should have enough there. Bedtime :p
Coder777 You make me cry at night...
And thanks for all of your help soranz!.
You actually help a whole hell of a lot.. I really wasn't understanding what I was doing or what I really needed to accomplish. Thanks again!

I get private and constant confused coder777 I just saw that typo.. Even though they are completely different they are stored right next to each other in my head.
Ur welcome. I'm glad to be of help :)

I think Coder777 is only trying to help u describe your problem(s) in a way that is logical and coherent so that ppl can help u more effectively solve them. I have to admit that I too had no idea what u were really asking for and just took a guess.

Cheers
Topic archived. No new replies allowed.