-
I have made a function for displaying text basing the coordinates on a given XY point:
Code:
void xytext(int x, int y, char *text)
{
move_to(x,y); /*move graphics device to x,y */
plots(text); /*plots the text string */
}
This will plot the given text to a given point. This is intended for powerc(you can use another compiler) or any compiler that doesn't have the function outtextxy();
Here is my problem: I would like to turn an integer so I can put it into a string, to display it using this function. I'm not good with strings, so can you tell me how I could add that string(converted int) to the end of another string(a phrase), so I can do something like this:
"Mouse X = " + (Interger(say 77) to string)
"Mouse X = " + "77"
"Mouse X = 77"
You get it? Please help me on this. It's EXTREMELY IMPORTANT!!!
-
PHP Code:
char buf[40];
itoa(number, buf, 10);
-
Thanks, Parksie!!!
Now how would I add that to the end of a string? (add 2 strings into 1)
-
Use the "strcat" function.
Code:
.
.
.
char buff[10] = "Hello ";
char buff2[10] = "world!";
strcat(buff, buff2);
.
.
.
-
Also, sprintf should help here:
Code:
char buf[100];
sprintf(buf, "Pos: (%d, %d)", xpos, ypos);
-
OK, That works. Now, I try to switch into a mode using interrupts. This causes my function to not work. Any ideas??? Does anyone have a substitute for my function that will work?
-
I think you need to restore the interrupt state after changing...not totally sure...it's just what I remembered from browsing that VBE documentation ages ago.
-
You mean VESA? I was using those VBE modes. Can you figure out how to restore the interrupt states? I'll try as well. Thanks
-
Ok... Maybe the PowerC print functions aren't good enough. Does anyone know the source code for outtextxy(int x, int y, char *text); , or a similar function? This is higher priority than my thread's actual topic. Please help...